Class TcpNioSSLConnection

All Implemented Interfaces:
Runnable, TcpConnection

public class TcpNioSSLConnection
extends TcpNioConnection
Implementation of TcpConnection supporting SSL/TLS over NIO. Unlike TcpNetConnection, which uses Sockets, the JVM does not directly support SSL for SocketChannels, used by NIO. Instead, the SSLEngine is provided whereby the SSL encryption is performed by passing in a plain text buffer, and receiving an encrypted buffer to transmit over the network. Similarly, encrypted data read from the network is decrypted.

However, before this can be done, certain handshaking operations are required, involving the creation of data buffers which must be exchanged by the peers. A number of such transfers are required; once the handshake is finished, it is relatively simple to encrypt/decrypt the data.

Also, it may be deemed necessary to re-perform handshaking.

This class supports the management of handshaking as necessary, both from the initiating and receiving peers.

Since:
2.2
Author:
Gary Russell, Artem Bilan