Class WrapperSslSocketFactory


  • public class WrapperSslSocketFactory
    extends javax.net.ssl.SSLSocketFactory
    SSL socket factory that wraps the default one to do extra initialization. Configures the cipher suites and the SSL certificate request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.Socket createSocket()  
      java.net.Socket createSocket​(java.lang.String host, int port)  
      java.net.Socket createSocket​(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort)  
      java.net.Socket createSocket​(java.net.InetAddress host, int port)  
      java.net.Socket createSocket​(java.net.InetAddress host, int port, java.net.InetAddress localAddress, int localPort)  
      java.net.Socket createSocket​(java.net.Socket s, java.lang.String host, int port, boolean autoClose)  
      DefaultSslContextFactory getContextFactory()
      Returns the parent SSL context factory.
      java.lang.String[] getDefaultCipherSuites()  
      java.lang.String[] getSupportedCipherSuites()  
      javax.net.ssl.SSLSocketFactory getWrappedSocketFactory()
      Returns the wrapped SSL socket factory.
      protected javax.net.ssl.SSLSocket initSslSocket​(javax.net.ssl.SSLSocket sslSocket)
      Initializes the SSL socket.
      • Methods inherited from class javax.net.ssl.SSLSocketFactory

        createSocket, getDefault
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • wrappedSocketFactory

        private final javax.net.ssl.SSLSocketFactory wrappedSocketFactory
        The wrapped SSL server socket factory.
    • Constructor Detail

      • WrapperSslSocketFactory

        public WrapperSslSocketFactory​(DefaultSslContextFactory contextFactory,
                                       javax.net.ssl.SSLSocketFactory wrappedSocketFactory)
        Constructor.
        Parameters:
        contextFactory - The parent SSL context factory.
        wrappedSocketFactory - The wrapped SSL server socket factory.
    • Method Detail

      • createSocket

        public java.net.Socket createSocket()
                                     throws java.io.IOException
        Overrides:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.net.InetAddress host,
                                            int port)
                                     throws java.io.IOException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.net.InetAddress host,
                                            int port,
                                            java.net.InetAddress localAddress,
                                            int localPort)
                                     throws java.io.IOException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.net.Socket s,
                                            java.lang.String host,
                                            int port,
                                            boolean autoClose)
                                     throws java.io.IOException
        Specified by:
        createSocket in class javax.net.ssl.SSLSocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.lang.String host,
                                            int port)
                                     throws java.io.IOException,
                                            java.net.UnknownHostException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
        java.net.UnknownHostException
      • createSocket

        public java.net.Socket createSocket​(java.lang.String host,
                                            int port,
                                            java.net.InetAddress localAddress,
                                            int localPort)
                                     throws java.io.IOException,
                                            java.net.UnknownHostException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
        java.net.UnknownHostException
      • getContextFactory

        public DefaultSslContextFactory getContextFactory()
        Returns the parent SSL context factory.
        Returns:
        The parent SSL context factory.
      • getDefaultCipherSuites

        public java.lang.String[] getDefaultCipherSuites()
        Specified by:
        getDefaultCipherSuites in class javax.net.ssl.SSLSocketFactory
      • getSupportedCipherSuites

        public java.lang.String[] getSupportedCipherSuites()
        Specified by:
        getSupportedCipherSuites in class javax.net.ssl.SSLSocketFactory
      • getWrappedSocketFactory

        public javax.net.ssl.SSLSocketFactory getWrappedSocketFactory()
        Returns the wrapped SSL socket factory.
        Returns:
        The wrapped SSL socket factory.
      • initSslSocket

        protected javax.net.ssl.SSLSocket initSslSocket​(javax.net.ssl.SSLSocket sslSocket)
        Initializes the SSL socket. Configures the certificate request (need or want) and the enabled cipher suites.
        Parameters:
        sslSocket - The socket to initialize.
        Returns:
        The initialized socket.