code: private static ChannelFuture socksConnect(Channel channel, InetSocketAddress remoteAddress)
      {
          channel.write(createHandshake(remoteAddress));
          return ((Socks4HandshakeHandler) channel.getPipeline().get("handshake")).getChannelFuture();
      }
docs: try to look at the remoteAddress and decide to use SOCKS4 or SOCKS4a handshake
  packet.