private HostConfiguration setupSSLIfNeeded(Settings settings, SecureSettings secureSettings, HostConfiguration hostConfig) { if (!sslEnabled) { return hostConfig; } // we actually have a socks proxy, let's start the setup if (log.isDebugEnabled()) { log.debug("SSL Connection enabled"); } // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // String schema = "https"; int port = 443; SecureProtocolSocketFactory sslFactory = new SSLSocketFactory(settings, secureSettings); replaceProtocol(sslFactory, schema, port); return hostConfig; }
int port = sslEnabled ? 443 : 80; SocksSocketFactory socketFactory = new SocksSocketFactory(proxyHost, proxyPort, proxyUser, proxyPass); replaceProtocol(socketFactory, schema, port);
@Test public void testProtocolReplacement() throws Exception { final ProtocolSocketFactory socketFactory = getSocketFactory(); CommonsHttpTransport.replaceProtocol(socketFactory, "https", 443); Protocol protocol = Protocol.getProtocol("https"); assertThat(protocol, instanceOf(DelegatedProtocol.class)); DelegatedProtocol delegatedProtocol = (DelegatedProtocol) protocol; assertThat(delegatedProtocol.getSocketFactory(), sameInstance(socketFactory)); assertThat(delegatedProtocol.getOriginal(), sameInstance(original)); // ensure we do not re-wrap a delegated protocol CommonsHttpTransport.replaceProtocol(socketFactory, "https", 443); protocol = Protocol.getProtocol("https"); assertThat(protocol, instanceOf(DelegatedProtocol.class)); delegatedProtocol = (DelegatedProtocol) protocol; assertThat(delegatedProtocol.getSocketFactory(), sameInstance(socketFactory)); assertThat(delegatedProtocol.getOriginal(), sameInstance(original)); }
private HostConfiguration setupSSLIfNeeded(Settings settings, SecureSettings secureSettings, HostConfiguration hostConfig) { if (!sslEnabled) { return hostConfig; } // we actually have a socks proxy, let's start the setup if (log.isDebugEnabled()) { log.debug("SSL Connection enabled"); } // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // String schema = "https"; int port = 443; SecureProtocolSocketFactory sslFactory = new SSLSocketFactory(settings, secureSettings); replaceProtocol(sslFactory, schema, port); return hostConfig; }
private HostConfiguration setupSSLIfNeeded(Settings settings, SecureSettings secureSettings, HostConfiguration hostConfig) { if (!sslEnabled) { return hostConfig; } // we actually have a socks proxy, let's start the setup if (log.isDebugEnabled()) { log.debug("SSL Connection enabled"); } // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // String schema = "https"; int port = 443; SecureProtocolSocketFactory sslFactory = new SSLSocketFactory(settings, secureSettings); replaceProtocol(sslFactory, schema, port); return hostConfig; }
private HostConfiguration setupSSLIfNeeded(Settings settings, HostConfiguration hostConfig) { if (!sslEnabled) { return hostConfig; } // we actually have a socks proxy, let's start the setup if (log.isDebugEnabled()) { log.debug("SSL Connection enabled"); } // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // String schema = "https"; int port = 443; SecureProtocolSocketFactory sslFactory = new SSLSocketFactory(settings); replaceProtocol(sslFactory, schema, port); return hostConfig; }
private HostConfiguration setupSSLIfNeeded(Settings settings, SecureSettings secureSettings, HostConfiguration hostConfig) { if (!sslEnabled) { return hostConfig; } // we actually have a socks proxy, let's start the setup if (log.isDebugEnabled()) { log.debug("SSL Connection enabled"); } // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // String schema = "https"; int port = 443; SecureProtocolSocketFactory sslFactory = new SSLSocketFactory(settings, secureSettings); replaceProtocol(sslFactory, schema, port); return hostConfig; }
int port = sslEnabled ? 443 : 80; SocksSocketFactory socketFactory = new SocksSocketFactory(proxyHost, proxyPort, proxyUser, proxyPass); replaceProtocol(socketFactory, schema, port);
int port = sslEnabled ? 443 : 80; SocksSocketFactory socketFactory = new SocksSocketFactory(proxyHost, proxyPort, proxyUser, proxyPass); replaceProtocol(socketFactory, schema, port);
int port = sslEnabled ? 443 : 80; SocksSocketFactory socketFactory = new SocksSocketFactory(proxyHost, proxyPort, proxyUser, proxyPass); replaceProtocol(socketFactory, schema, port);
int port = sslEnabled ? 443 : 80; SocksSocketFactory socketFactory = new SocksSocketFactory(proxyHost, proxyPort, proxyUser, proxyPass); replaceProtocol(socketFactory, schema, port);