code: public void messageReceived(final NextFilter nextFilter,
              final IoBuffer buf) {
          try {
              if (buf.remaining() >= SocksProxyConstants.SOCKS_4_RESPONSE_SIZE) {
                  handleResponse(buf);
              }
          } catch (Exception ex) {
              closeSession("Proxy handshake failed: ", ex);
          }
      }
docs: Handle incoming data during the handshake process. Should consume only the
  handshake data from the buffer, leaving any extra data in place.
  
  @param nextFilter the next filter
  @param buf the server response data buffer