code: @Override
    public void connect(
        ChannelHandlerContext ctx,
        SocketAddress remoteAddress,
        SocketAddress localAddress,
        ChannelPromise promise) throws Exception {
      final class ConnectListener implements ChannelFutureListener {
        @Override
        public void operationComplete(ChannelFuture future) {
          if (!future.isSuccess()) {
            failWrites(future.cause());
          }
        }
      }
  
      super.connect(ctx, remoteAddress, localAddress, promise);
      promise.addListener(new ConnectListener());
    }
docs: Connect failures do not show up as {@link #channelInactive} or {@link #exceptionCaught}, so
  it needs to be watched.