Class TLSStreamHandler

  • public class TLSStreamHandler
    extends Object
    TLSStreamHandler is responsible for securing plain connections by negotiating TLS. By creating a new instance of this class the plain connection will be encrypted.
    Hao Chen
    • Constructor Detail

      • TLSStreamHandler

        public TLSStreamHandler​(Socket socket,
                                ConnectionConfiguration configuration,
                                boolean clientMode)
                         throws IOException
        Creates a new TLSStreamHandler and encrypt the plain socket connection. When connecting to a remote server then clientMode will be true and remoteServer is the server name of the remote server. Otherwise clientMode will be false and remoteServer null.
        socket - the plain socket connection to encrypt
        configuration - the configuration for the connection
        clientMode - boolean indicating if this entity is a client or a server.
        IOException - if an exception occurs
    • Method Detail

      • close

        public void close()
                   throws IOException
        Closes the channels that will end up closing the input and output streams of the connection. The channels implement the InterruptibleChannel interface so any other thread that was blocked in an I/O operation will be interrupted and will get an exception.
        IOException - if an I/O error occurs.
      • getSSLSession

        public SSLSession getSSLSession()
        Returns the SSLSession in use. The session specifies a particular cipher suite which is being actively used by all connections in that session, as well as the identities of the session's client and server.
        the SSLSession in use.