Package org.jivesoftware.openfire.net
Class TLSStreamHandler
- java.lang.Object
-
- org.jivesoftware.openfire.net.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 secured.- Author:
- Hao Chen
-
-
Constructor Summary
Constructors Constructor Description TLSStreamHandler(Socket socket, ConnectionConfiguration configuration, boolean clientMode)
Creates a new TLSStreamHandler and secures the plain socket connection.TLSStreamHandler(Connection connection, Socket socket, boolean clientMode, String remoteServer, boolean needClientAuth)
Deprecated.Use the other constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the channels that will end up closing the input and output streams of the connection.InputStream
getInputStream()
OutputStream
getOutputStream()
SSLSession
getSSLSession()
Returns the SSLSession in use.void
start()
-
-
-
Constructor Detail
-
TLSStreamHandler
@Deprecated public TLSStreamHandler(Connection connection, Socket socket, boolean clientMode, String remoteServer, boolean needClientAuth) throws IOException
Deprecated.Use the other constructor.- Parameters:
connection
- the configuration for the connectionsocket
- the plain socket connection to secureclientMode
- unused parameterremoteServer
- unused parameterneedClientAuth
- unused parameter- Throws:
IOException
- if an exception occurs
-
TLSStreamHandler
public TLSStreamHandler(Socket socket, ConnectionConfiguration configuration, boolean clientMode) throws IOException
Creates a new TLSStreamHandler and secures the plain socket connection. When connecting to a remote server thenclientMode
will betrue
andremoteServer
is the server name of the remote server. OtherwiseclientMode
will befalse
andremoteServer
null.- Parameters:
socket
- the plain socket connection to secureconfiguration
- the configuration for the connectionclientMode
- boolean indicating if this entity is a client or a server.- Throws:
IOException
- if an exception occurs
-
-
Method Detail
-
getInputStream
public InputStream getInputStream()
-
getOutputStream
public OutputStream getOutputStream()
-
start
public void start() throws IOException
- Throws:
IOException
-
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.- Throws:
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.- Returns:
- the SSLSession in use.
-
-