public class ThreadLocalSSLSocketFactory extends SSLSocketFactory
To set this as the default call install() prior to making any HTTPS connections, then bracket code which needs to trust unsigned certificates in the startTrustingEverything() and stopTrustingEverything() methods.
Modifier and Type | Method and Description |
---|---|
Socket |
createSocket() |
Socket |
createSocket(InetAddress arg0,
int arg1) |
Socket |
createSocket(InetAddress arg0,
int arg1,
InetAddress arg2,
int arg3) |
Socket |
createSocket(Socket arg0,
String arg1,
int arg2,
boolean arg3) |
Socket |
createSocket(String arg0,
int arg1) |
Socket |
createSocket(String arg0,
int arg1,
InetAddress arg2,
int arg3) |
String[] |
getDefaultCipherSuites() |
String[] |
getSupportedCipherSuites() |
static void |
install()
Set this as the default global socket factory for HTTPS connections
|
static boolean |
isTrustingEverything()
Determine whether the current thread will trust unsigned certificates
|
static void |
startTrustingEverything()
Calls to open HTTPS connections will trust unsigned certificates afer
this call is made, this is scoped to the current thread only.
|
static void |
stopTrustingEverything()
Stop trusting unsigned certificates, reverting to the default behaviour
for the current thread.
|
createSocket, getDefault
public static void startTrustingEverything()
public static void stopTrustingEverything()
public static void install()
public static boolean isTrustingEverything()
public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) throws IOException
createSocket
in class SSLSocketFactory
IOException
public String[] getDefaultCipherSuites()
getDefaultCipherSuites
in class SSLSocketFactory
public String[] getSupportedCipherSuites()
getSupportedCipherSuites
in class SSLSocketFactory
public Socket createSocket() throws IOException
createSocket
in class SocketFactory
IOException
public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
public Socket createSocket(InetAddress arg0, int arg1) throws IOException
createSocket
in class SocketFactory
IOException
public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
createSocket
in class SocketFactory
IOException
UnknownHostException
public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
createSocket
in class SocketFactory
IOException
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.