public class SslChannel2Connection extends Object
Data through the TcpChannel are encrypted SSL records, while data through SslConnection interface are decrypted/plain text.
| Constructor and Description |
|---|
SslChannel2Connection(boolean clientMode,
SSLContext sslContext,
ConsumerX<SSLEngine> sslEngineConf)
Create a TcpChannel to SslConnection converter
|
| Instance Methods | |
|---|---|
Async<SslConnection> |
convert(TcpChannel channel)
Convert a TcpChannel to an SslConnection.
|
Async<TcpConnection> |
convert(TcpChannel channel,
TcpChannel2Connection plainConverter)
Convert a server-side TcpChannel to SslConnection or plain TcpConnection.
|
public SslChannel2Connection(boolean clientMode,
SSLContext sslContext,
ConsumerX<SSLEngine> sslEngineConf)
throws Exception
Examples of `sslEngineConf`:
sslEngineConf = engine->
{
engine.setWantClientAuth(true); // server wants client certificates
};
sslEngineConf = engine->
{
SSLParameters sslParameters = engine.getSSLParameters();
sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); // client verifies server host name
engine.setSSLParameters(sslParameters);
};
public Async<SslConnection> convert(TcpChannel channel)
This async action completes when the SSL handshake succeeds or fails.
public Async<TcpConnection> convert(TcpChannel channel, TcpChannel2Connection plainConverter)
This is for server side only, `clientMode` must be false.
Initial bytes from the client is used to detect the type of the connection.
The app protocol must
have the client write some data first; and the first byte of the app data
must not be 22 (0x16). For example, HTTP protocol satisfies these requirements.