test fixes

This commit is contained in:
Clercq 2022-09-01 02:33:45 +03:00
parent 30bb6b0b22
commit 688d7e6b10

View file

@ -57,6 +57,7 @@ private void injectCertificates() {
final Map<String, Certificate> jdkTrustStore = getDefaultKeyStore();
// Создание нового KeyStore с дополнительными сертификатами.
final KeyStore mergedTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
mergedTrustStore.load(null, new char[0]);
// добавление дополнительных сертификатов в новый KeyStore
Arrays.stream(trustSigners).forEach(cert -> setCertificateEntry(mergedTrustStore, "injected-certificate" + UUID.randomUUID(), cert));
@ -73,7 +74,7 @@ private void injectCertificates() {
// Установка контекста по умолчанию
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
LogHelper.info("Successfully injected certificates to truststore");
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | IOException | CertificateException e) {
LogHelper.error("Error while modify existing keystore");
}
}