### Question:
PEMCertInfo implements CertInfo<HttpClientConfig.Builder> { @Override public void applyTo(HttpClientConfig.Builder builder) { if (java.security.Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) { java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); } try ( FileInputStream clientCert = new FileInputStream(new File(clientCertPath)); FileInputStream key = new FileInputStream(new File(keyPath)); FileInputStream certificateAuthoritiies = new FileInputStream(new File(caPath)) ) { KeyStore keyStore = PemReader.loadKeyStore(clientCert, key, Optional.ofNullable(keyPassphrase)); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, keyPassphrase.toCharArray()); KeyStore trustStore = PemReader.loadTrustStore(certificateAuthoritiies); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); builder.sslSocketFactory(new SSLConnectionSocketFactory(sslContext)); builder.httpsIOSessionStrategy(new SSLIOSessionStrategy(sslContext, new NoopHostnameVerifier())); } catch (IOException | GeneralSecurityException e) { throw new ConfigurationException(configExceptionMessage, e); } } protected  PEMCertInfo(String keyPath, String keyPassphrase, String clientCertPath, String caPath); @Override void applyTo(HttpClientConfig.Builder builder); @PluginBuilderFactory static PEMCertInfo.Builder newBuilder();  }### Answer:
@Test public void paramsArePassedToConfiguredObject() { PEMCertInfo certInfo = createTestCertInfoBuilder() .withKeyPath(TEST_KEY_PATH) .withKeyPassphrase(TEST_KEY_PASSPHRASE) .withClientCertPath(TEST_CLIENT_CERT_PATH) .withCaPath(TEST_CA_PATH) .build(); HttpClientConfig.Builder clientConfigBuilder = spy(createDefaultClientConfigBuilder()); certInfo.applyTo(clientConfigBuilder); verify(clientConfigBuilder).httpsIOSessionStrategy((SchemeIOSessionStrategy) notNull()); Assert.assertNotNull(clientConfigBuilder.build().getHttpsIOSessionStrategy()); }
@Test public void builderThrowsIfCantReadKey() { PEMCertInfo testCertInfo = createTestCertInfoBuilder() .withKeyPath(TEST_KEY_PATH_WITH_PASSPHRASE) .withKeyPassphrase("") .build(); expectedException.expect(ConfigurationException.class); expectedException.expectMessage(PEMCertInfo.configExceptionMessage); testCertInfo.applyTo(mock(HttpClientConfig.Builder.class)); }