@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // This must be a single byte buffer - after that follow the SSL handshake ByteBuf byteBuf = (ByteBuf) msg; byte b = byteBuf.getByte(0); byteBuf.release(); switch (b) { case MessageType.SSL_YES: { conn.socket().upgradeToSsl(v -> { ctx.pipeline().remove(this); upgradeFuture.complete(); }); break; } case MessageType.SSL_NO: { upgradeFuture.fail(new Exception("Postgres Server does not handle SSL connection")); break; } default: upgradeFuture.fail(new Exception("Invalid SSL connection message")); break; } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // This must be a single byte buffer - after that follow the SSL handshake ByteBuf byteBuf = (ByteBuf) msg; byte b = byteBuf.getByte(0); byteBuf.release(); switch (b) { case MessageType.SSL_YES: { conn.socket().upgradeToSsl(v -> { ctx.pipeline().remove(this); upgradeFuture.complete(); }); break; } case MessageType.SSL_NO: { upgradeFuture.fail(new Exception("Postgres Server does not handle SSL connection")); break; } default: upgradeFuture.fail(new Exception("Invalid SSL connection message")); break; } }