SSLUtils { @VisibleForTesting static TrustManager getTrustManager(ClientConfig config) { if (config.isDisableSSLValidation()) { return new AcceptAllTrustManager(); } if (config.getOverrideTrustManager() != null) { return config.getOverrideTrustManager(); } return createTrustManager(config); }  static boolean isSSL(String urlString); static SSLContext getSSLContext(ClientConfig config); static HostnameVerifier getHostnameVerifier(ClientConfig config);  }
@Test public void testGetTrustManager() throws Exception { ClassLoader classLoader = getClass().getClassLoader(); config.setSSLTrustStoreLocation(classLoader.getResource("trust.jks") .getFile()); config.setSSLTrustStorePassword("trustP"); TrustManager trustManager = SSLUtils.getTrustManager(config); assertTrue(trustManager instanceof X509TrustManager); ((X509TrustManager)trustManager).checkClientTrusted( certs.values().toArray(new X509Certificate[certs.size()]), "RSA"); config.setOverrideTrustManager(new TestTrustManager()); trustManager = SSLUtils.getTrustManager(config); assertTrue(trustManager instanceof TestTrustManager); config.setDisableSSLValidation(true); trustManager = SSLUtils.getTrustManager(config); assertTrue(trustManager instanceof SSLUtils.AcceptAllTrustManager); }