Source:
public static X509TrustManager createTrustManager( String trustStoreLocation, String trustStorePassword, String trustStoreTypeProp, boolean crlEnabled, boolean ocspEnabled, final boolean serverHostnameVerificationEnabled, final boolean clientHostnameVerificationEnabled) throws TrustManagerException { FileInputStream inputStream = null; if (trustStorePassword == null) { trustStorePassword = ""; } try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( trustStoreTypeProp, trustStoreLocation); KeyStore ts = FileKeyStoreLoader .getBuilderForKeyStoreFileType(storeFileType) .setTrustStorePath(trustStoreLocation) .setTrustStorePassword(trustStorePassword) .build() .loadTrustStore(); PKIXBuilderParameters pbParams = new PKIXBuilderParameters(ts, new X509CertSelector()); if (crlEnabled || ocspEnabled) { pbParams.setRevocationEnabled(true); System.setProperty("com.sun.net.ssl.checkRevocation", "true"); System.setProperty("com.sun.security.enableCRLDP", "true"); if (ocspEnabled) { Security.setProperty("ocsp.enable", "true"); } } else { pbParams.setRevocationEnabled(false); } TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); tmf.init(new CertPathTrustManagerParameters(pbParams)); for (final TrustManager tm : tmf.getTrustManagers()) { if (tm instanceof X509ExtendedTrustManager) { return new ZKTrustManager((X509ExtendedTrustManager) tm, serverHostnameVerificationEnabled, clientHostnameVerificationEnabled); } } throw new TrustManagerException("Couldn't find X509TrustManager"); } catch (IOException | GeneralSecurityException trustManagerCreationException) { throw new TrustManagerException(trustManagerCreationException); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ioException) { LOG.info("failed to close TrustStore input stream", ioException); } } } }

Target:
public static X509TrustManager createTrustManager( String trustStoreLocation, String trustStorePassword, String trustStoreTypeProp, boolean crlEnabled, boolean ocspEnabled, final boolean serverHostnameVerificationEnabled, final boolean clientHostnameVerificationEnabled) throws TrustManagerException { if (trustStorePassword == null) { trustStorePassword = ""; } try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( trustStoreTypeProp, trustStoreLocation); KeyStore ts = FileKeyStoreLoaderBuilderProvider .getBuilderForKeyStoreFileType(storeFileType) .setTrustStorePath(trustStoreLocation) .setTrustStorePassword(trustStorePassword) .build() .loadTrustStore(); PKIXBuilderParameters pbParams = new PKIXBuilderParameters(ts, new X509CertSelector()); if (crlEnabled || ocspEnabled) { pbParams.setRevocationEnabled(true); System.setProperty("com.sun.net.ssl.checkRevocation", "true"); System.setProperty("com.sun.security.enableCRLDP", "true"); if (ocspEnabled) { Security.setProperty("ocsp.enable", "true"); } } else { pbParams.setRevocationEnabled(false); } TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); tmf.init(new CertPathTrustManagerParameters(pbParams)); for (final TrustManager tm : tmf.getTrustManagers()) { if (tm instanceof X509ExtendedTrustManager) { return new ZKTrustManager((X509ExtendedTrustManager) tm, serverHostnameVerificationEnabled, clientHostnameVerificationEnabled); } } throw new TrustManagerException("Couldn't find X509TrustManager"); } catch (IOException | GeneralSecurityException | IllegalArgumentException e) { throw new TrustManagerException(e); } }