/** * Returns an instance of this socket factory configured with a hostname verifying trust manager. If the supplied ssl * config does not contain trust managers, {@link HostnameVerifyingTrustManager} with {@link DefaultHostnameVerifier} * is set. See {@link #addHostnameVerifyingTrustManager(SslConfig, String[])}. * * @param config to set on the socket factory * @param names to use for hostname verification * * @return socket factory */ public static SSLSocketFactory getHostnameVerifierFactory(final SslConfig config, final String[] names) { final ThreadLocalTLSSocketFactory sf = new ThreadLocalTLSSocketFactory(); if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else { sf.setSslConfig(new SslConfig()); } addHostnameVerifyingTrustManager(sf.getSslConfig(), names); try { sf.initialize(); } catch (GeneralSecurityException e) { throw new IllegalArgumentException(e); } return sf; }
/** * Returns an instance of this socket factory configured with a hostname verifying trust manager. If the supplied ssl * config does not contain trust managers, {@link HostnameVerifyingTrustManager} with {@link DefaultHostnameVerifier} * is set. See {@link #addHostnameVerifyingTrustManager(SslConfig, String[])}. * * @param config to set on the socket factory * @param names to use for hostname verification * * @return socket factory */ @SuppressWarnings("RedundantArrayCreation") public static SSLSocketFactory getHostnameVerifierFactory(final SslConfig config, final String[] names) { final TLSSocketFactory sf = new TLSSocketFactory(); if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else { sf.setSslConfig(new SslConfig()); } addHostnameVerifyingTrustManager(sf.getSslConfig(), names); try { sf.initialize(); } catch (GeneralSecurityException e) { throw new IllegalArgumentException(e); } return sf; }
if (factory == null && cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { final TLSSocketFactory sf = new TLSSocketFactory(); sf.setSslConfig(cc.getSslConfig());
if (factory == null && cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { final TLSSocketFactory sf = new TLSSocketFactory(); sf.setSslConfig(SslConfig.newSslConfig(cc.getSslConfig())); if (verifier == null && cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { if (cc.getSslConfig().getHostnameVerifier() != null) { verifier = new HostnameVerifierAdapter(cc.getSslConfig().getHostnameVerifier());
if (factory == null && cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { final TLSSocketFactory sf = new TLSSocketFactory(); sf.setSslConfig(SslConfig.newSslConfig(cc.getSslConfig())); if (verifier == null && cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { if (cc.getSslConfig().getHostnameVerifier() != null) { verifier = new HostnameVerifierAdapter(cc.getSslConfig().getHostnameVerifier());
if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else {
if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else {
if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else {
if (config != null && !config.isEmpty()) { sf.setSslConfig(SslConfig.newSslConfig(config)); } else {
if (!sc.isEmpty()) { object.setSslConfig(sc);
if (!sc.isEmpty()) { object.setSslConfig(sc);
if (!sc.isEmpty()) { object.setSslConfig(sc);
if (cc.getSslConfig() != null && !cc.getSslConfig().isEmpty()) { final CredentialConfig credConfig = cc.getSslConfig().getCredentialConfig(); final TrustManager[] managers = cc.getSslConfig().getTrustManagers();