Package org.htmlunit.httpclient
Class HtmlUnitSSLConnectionSocketFactory
java.lang.Object
org.apache.http.conn.ssl.SSLConnectionSocketFactory
org.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory
- All Implemented Interfaces:
org.apache.http.conn.socket.ConnectionSocketFactory
,org.apache.http.conn.socket.LayeredConnectionSocketFactory
public final class HtmlUnitSSLConnectionSocketFactory
extends org.apache.http.conn.ssl.SSLConnectionSocketFactory
Socket factory offering facilities for insecure SSL and for SOCKS proxy support.
This looks rather like a hack than like clean code but at the time of the writing it seems to
be the easiest way to provide SOCKS proxy support for HTTPS.
-
Field Summary
FieldsFields inherited from class org.apache.http.conn.ssl.SSLConnectionSocketFactory
ALLOW_ALL_HOSTNAME_VERIFIER, BROWSER_COMPATIBLE_HOSTNAME_VERIFIER, SSL, SSLV2, STRICT_HOSTNAME_VERIFIER, TLS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
HtmlUnitSSLConnectionSocketFactory
(KeyStore keystore, char[] keystorePassword, KeyStore truststore, boolean useInsecureSSL, String[] supportedProtocols, String[] supportedCipherSuites) private
HtmlUnitSSLConnectionSocketFactory
(SSLContext sslContext, HostnameVerifier hostnameVerifier, boolean useInsecureSSL, String[] supportedProtocols, String[] supportedCipherSuites) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.http.conn.ssl.SSLConnectionSocketFactory
buildSSLSocketFactory
(WebClientOptions options) Factory method that builds a new SSLConnectionSocketFactory.private static void
configureSocket
(SSLSocket sslSocket, org.apache.http.protocol.HttpContext context) connectSocket
(int connectTimeout, Socket socket, org.apache.http.HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, org.apache.http.protocol.HttpContext context) Connect via socket.private static KeyManager[]
getKeyManagers
(WebClientOptions options) private SSLSocketFactory
(package private) static boolean
isUseSSL3Only
(org.apache.http.protocol.HttpContext context) private static void
setEmptyHostname
(org.apache.http.HttpHost host) static void
setUseSSL3Only
(org.apache.http.protocol.HttpContext httpContext, boolean ssl3Only) Enables/Disables the exclusive usage of SSL3.Methods inherited from class org.apache.http.conn.ssl.SSLConnectionSocketFactory
createLayeredSocket, createSocket, getDefaultHostnameVerifier, getSocketFactory, getSystemSocketFactory, prepareSocket
-
Field Details
-
SSL3ONLY
- See Also:
-
useInsecureSSL_
private final boolean useInsecureSSL_
-
-
Constructor Details
-
HtmlUnitSSLConnectionSocketFactory
private HtmlUnitSSLConnectionSocketFactory(SSLContext sslContext, HostnameVerifier hostnameVerifier, boolean useInsecureSSL, String[] supportedProtocols, String[] supportedCipherSuites) -
HtmlUnitSSLConnectionSocketFactory
private HtmlUnitSSLConnectionSocketFactory(KeyStore keystore, char[] keystorePassword, KeyStore truststore, boolean useInsecureSSL, String[] supportedProtocols, String[] supportedCipherSuites) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
-
-
Method Details
-
setUseSSL3Only
public static void setUseSSL3Only(org.apache.http.protocol.HttpContext httpContext, boolean ssl3Only) Enables/Disables the exclusive usage of SSL3.- Parameters:
httpContext
- the http contextssl3Only
- true or false
-
isUseSSL3Only
static boolean isUseSSL3Only(org.apache.http.protocol.HttpContext context) -
buildSSLSocketFactory
public static org.apache.http.conn.ssl.SSLConnectionSocketFactory buildSSLSocketFactory(WebClientOptions options) Factory method that builds a new SSLConnectionSocketFactory.- Parameters:
options
- the current WebClientOptions- Returns:
- the SSLConnectionSocketFactory
-
configureSocket
private static void configureSocket(SSLSocket sslSocket, org.apache.http.protocol.HttpContext context) -
connectSocket
public Socket connectSocket(int connectTimeout, Socket socket, org.apache.http.HttpHost host, InetSocketAddress remoteAddress, InetSocketAddress localAddress, org.apache.http.protocol.HttpContext context) throws IOException Connect via socket.- Specified by:
connectSocket
in interfaceorg.apache.http.conn.socket.ConnectionSocketFactory
- Overrides:
connectSocket
in classorg.apache.http.conn.ssl.SSLConnectionSocketFactory
- Parameters:
connectTimeout
- the timeoutsocket
- the sockethost
- the hostremoteAddress
- the remote addresslocalAddress
- the local addresscontext
- the context- Returns:
- the created/connected socket
- Throws:
IOException
- in case of problems
-
setEmptyHostname
private static void setEmptyHostname(org.apache.http.HttpHost host) -
getSSLSocketFactory
-
getKeyManagers
-