Class SynchronizedSSLSocketFactory

java.lang.Object
javax.net.SocketFactory
javax.net.ssl.SSLSocketFactory
com.unboundid.util.SynchronizedSSLSocketFactory

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 Details

  • Method Details

    • getWrappedSocketFactory

      Retrieves the SSLSocketFactory instance wrapped by this synchronized SSL socket factory.
      Returns:
      The SSLSocketFactory instance wrapped by this synchronized SSL socket factory.
    • createSocket

      @NotNull public Socket createSocket(@NotNull String host, int port) throws IOException
      Creates a new SSL socket to the specified server.
      Specified by:
      createSocket in class 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:
      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:
      createSocket in class 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.
      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 InetAddress address, int port) throws IOException
      Creates a new SSL socket to the specified server.
      Specified by:
      createSocket in class 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:
      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:
      createSocket in class 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.
      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:
      createSocket in class 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:
      IOException - If a problem occurs while creating the socket.
    • getDefaultCipherSuites

      Retrieves the set of cipher suites which are enabled by default.
      Specified by:
      getDefaultCipherSuites in class SSLSocketFactory
      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:
      getSupportedCipherSuites in class SSLSocketFactory
      Returns:
      The entire set of cipher suites that could be used.