Package com.unboundid.util
Class SynchronizedSSLSocketFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- javax.net.ssl.SSLSocketFactory
-
- com.unboundid.util.SynchronizedSSLSocketFactory
-
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class SynchronizedSSLSocketFactory extends javax.net.ssl.SSLSocketFactory
This class provides an implementation of a Java socket factory that will wrap a provided socket factory but will synchronize on each use of that factory to ensure that only a single thread may use that factory to create a socket at any given time.
-
-
Constructor Summary
Constructors Constructor Description SynchronizedSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
Creates a new synchronous socket factory instance that will wrap the provided socket factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.Socket
createSocket(java.lang.String host, int port)
Creates a new SSL socket to the specified server.java.net.Socket
createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort)
Creates a new SSL socket to the specified server.java.net.Socket
createSocket(java.net.InetAddress address, int port)
Creates a new SSL socket to the specified server.java.net.Socket
createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort)
Creates a new SSL socket to the specified server.java.net.Socket
createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose)
Creates a new SSL socket that wraps the provided socket.java.lang.String[]
getDefaultCipherSuites()
Retrieves the set of cipher suites which are enabled by default.java.lang.String[]
getSupportedCipherSuites()
Retrieves the entire set of cipher suites that could be used.javax.net.ssl.SSLSocketFactory
getWrappedSocketFactory()
Retrieves theSSLSocketFactory
instance wrapped by this synchronized SSL socket factory.
-
-
-
Constructor Detail
-
SynchronizedSSLSocketFactory
public SynchronizedSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
Creates a new synchronous socket factory instance that will wrap the provided socket factory.- Parameters:
factory
- The socket factory to be wrapped.
-
-
Method Detail
-
getWrappedSocketFactory
public javax.net.ssl.SSLSocketFactory getWrappedSocketFactory()
Retrieves theSSLSocketFactory
instance wrapped by this synchronized SSL socket factory.- Returns:
- The
SSLSocketFactory
instance wrapped by this synchronized SSL socket factory.
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port) throws java.io.IOException
Creates a new SSL socket to the specified server.- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
host
- The host to which the connection should be established.port
- The port to which the connection should be established.- Returns:
- The SSL socket that was created.
- Throws:
java.io.IOException
- If a problem occurs while creating the socket.
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort) throws java.io.IOException
Creates a new SSL socket to the specified server.- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
host
- The host to which the connection should be established.port
- The port to which the connection should be established.localAddress
- The local address to use for the connection. This will be ignored.localPort
- The local port to use for the connection. This will be ignored.- Returns:
- The SSL socket that was created.
- Throws:
java.io.IOException
- If a problem occurs while creating the socket.
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress address, int port) throws java.io.IOException
Creates a new SSL socket to the specified server.- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
address
- The address to which the connection should be established.port
- The port to which the connection should be established.- Returns:
- The SSL socket that was created.
- Throws:
java.io.IOException
- If a problem occurs while creating the socket.
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort) throws java.io.IOException
Creates a new SSL socket to the specified server.- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
address
- The address to which the connection should be established.port
- The port to which the connection should be established.localAddress
- The local address to use for the connection. This will be ignored.localPort
- The local port to use for the connection. This will be ignored.- Returns:
- The SSL socket that was created.
- Throws:
java.io.IOException
- If a problem occurs while creating the socket.
-
createSocket
public java.net.Socket createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose) throws java.io.IOException
Creates a new SSL socket that wraps the provided socket.- Specified by:
createSocket
in classjavax.net.ssl.SSLSocketFactory
- Parameters:
s
- The existing socket to be wrapped to create an SSL socket.host
- The host to which the connection is established.port
- The port to which the connection is established.autoClose
- Indicates whether the provided socket should be closed when the created SSL socket is closed.- Returns:
- The SSL socket that was created.
- Throws:
java.io.IOException
- If a problem occurs while creating the socket.
-
getDefaultCipherSuites
public java.lang.String[] getDefaultCipherSuites()
Retrieves the set of cipher suites which are enabled by default.- Specified by:
getDefaultCipherSuites
in classjavax.net.ssl.SSLSocketFactory
- Returns:
- The set of cipher suites which are enabled by default.
-
getSupportedCipherSuites
public java.lang.String[] getSupportedCipherSuites()
Retrieves the entire set of cipher suites that could be used.- Specified by:
getSupportedCipherSuites
in classjavax.net.ssl.SSLSocketFactory
- Returns:
- The entire set of cipher suites that could be used.
-
-