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 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
ConstructorsConstructorDescriptionCreates a new synchronous socket factory instance that will wrap the provided socket factory. -
Method Summary
Modifier and TypeMethodDescriptioncreateSocket(String host, int port) Creates a new SSL socket to the specified server.createSocket(String host, int port, InetAddress localAddress, int localPort) Creates a new SSL socket to the specified server.createSocket(InetAddress address, int port) Creates a new SSL socket to the specified server.createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) Creates a new SSL socket to the specified server.createSocket(Socket s, String host, int port, boolean autoClose) Creates a new SSL socket that wraps the provided socket.String[]Retrieves the set of cipher suites which are enabled by default.String[]Retrieves the entire set of cipher suites that could be used.Retrieves theSSLSocketFactoryinstance wrapped by this synchronized SSL socket factory.Methods inherited from class javax.net.ssl.SSLSocketFactory
createSocket, getDefaultMethods inherited from class javax.net.SocketFactory
createSocket
-
Constructor Details
-
SynchronizedSSLSocketFactory
Creates a new synchronous socket factory instance that will wrap the provided socket factory.- Parameters:
factory- The socket factory to be wrapped.
-
-
Method Details
-
getWrappedSocketFactory
Retrieves theSSLSocketFactoryinstance wrapped by this synchronized SSL socket factory.- Returns:
- The
SSLSocketFactoryinstance wrapped by this synchronized SSL socket factory.
-
createSocket
Creates a new SSL socket to the specified server.- Specified by:
createSocketin classSocketFactory- 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:
IOException- If a problem occurs while creating the socket.
-
createSocket
@NotNull public Socket createSocket(@NotNull String host, int port, @NotNull InetAddress localAddress, int localPort) throws IOException Creates a new SSL socket to the specified server.- Specified by:
createSocketin classSocketFactory- 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.localPort- The local port to use for the connection.- Returns:
- The SSL socket that was created.
- Throws:
IOException- If a problem occurs while creating the socket.
-
createSocket
Creates a new SSL socket to the specified server.- Specified by:
createSocketin classSocketFactory- 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:
IOException- If a problem occurs while creating the socket.
-
createSocket
@NotNull public Socket createSocket(@NotNull InetAddress address, int port, @NotNull InetAddress localAddress, int localPort) throws IOException Creates a new SSL socket to the specified server.- Specified by:
createSocketin classSocketFactory- 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.localPort- The local port to use for the connection.- Returns:
- The SSL socket that was created.
- Throws:
IOException- If a problem occurs while creating the socket.
-
createSocket
@NotNull public Socket createSocket(@NotNull Socket s, @NotNull String host, int port, boolean autoClose) throws IOException Creates a new SSL socket that wraps the provided socket.- Specified by:
createSocketin classSSLSocketFactory- 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:
IOException- If a problem occurs while creating the socket.
-
getDefaultCipherSuites
Retrieves the set of cipher suites which are enabled by default.- Specified by:
getDefaultCipherSuitesin classSSLSocketFactory- Returns:
- The set of cipher suites which are enabled by default.
-
getSupportedCipherSuites
Retrieves the entire set of cipher suites that could be used.- Specified by:
getSupportedCipherSuitesin classSSLSocketFactory- Returns:
- The entire set of cipher suites that could be used.
-