if (options.isSsl()) {
// TCP connected, so now we must do the SSL handshake
SslHandler sslHandler = ch.pipeline().get(SslHandler.class);
io.netty.util.concurrent.Future<Channel> fut = sslHandler.handshakeFuture();
fut.addListener(fut2 -> {
if (fut2.isSuccess()) {
connected(context, port, host, ch, connectHandler, listener);
} else {
connectionFailed(context, ch, connectErrorHandler, new SSLHandshakeException("Failed to create SSL connection"),