org.apache.mina.proxy.handlers.socks

## Class Socks4LogicHandler

- java.lang.Object
- - org.apache.mina.proxy.AbstractProxyLogicHandler
  - - org.apache.mina.proxy.handlers.socks.AbstractSocksLogicHandler
    - - org.apache.mina.proxy.handlers.socks.Socks4LogicHandler

- All Implemented Interfaces:
    ProxyLogicHandler

      public class Socks4LogicHandler
      extends AbstractSocksLogicHandler

  Socks4LogicHandler.java - SOCKS4/SOCKS4a authentication mechanisms logic handler.
  Since:
    MINA 2.0.0-M3
  Author:
    Apache MINA Project

- - ### Field Summary

    - ### Fields inherited from class org.apache.mina.proxy.handlers.socks.AbstractSocksLogicHandler

      `request`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Socks4LogicHandler(ProxyIoSession proxyIoSession)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doHandshake(IoFilter.NextFilter nextFilter)` Perform the handshake.
    `protected void` | `handleResponse(IoBuffer buf)` Handle a SOCKS4/SOCKS4a response from the proxy server.
    `void` | `messageReceived(IoFilter.NextFilter nextFilter, IoBuffer buf)` Handle incoming data during the handshake process.
    `protected void` | `writeRequest(IoFilter.NextFilter nextFilter, SocksProxyRequest request)` Encode a SOCKS4/SOCKS4a request and writes it to the next filter so it can be sent to the proxy server.

    - ### Methods inherited from class org.apache.mina.proxy.AbstractProxyLogicHandler

      `closeSession, closeSession, enqueueWriteRequest, flushPendingWriteRequests, getProxyFilter, getProxyIoSession, getSession, isHandshakeComplete, setHandshakeComplete, writeData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Socks4LogicHandler

          public Socks4LogicHandler(ProxyIoSession proxyIoSession)

  - ### Method Detail

    - #### doHandshake

          public void doHandshake(IoFilter.NextFilter nextFilter)

      Perform the handshake.
      Parameters:
        `nextFilter` - the next filter

    - #### writeRequest

          protected void writeRequest(IoFilter.NextFilter nextFilter,
                          SocksProxyRequest request)

      Encode a SOCKS4/SOCKS4a request and writes it to the next filter so it can be sent to the proxy server.
      Parameters:
        `nextFilter` - the next filter
        `request` - the request to send.

    - #### messageReceived

          public void messageReceived(IoFilter.NextFilter nextFilter,
                             IoBuffer buf)

      Handle incoming data during the handshake process. Should consume only the handshake data from the buffer, leaving any extra data in place.
      Parameters:
        `nextFilter` - the next filter
        `buf` - the server response data buffer

    - #### handleResponse

          protected void handleResponse(IoBuffer buf)
                                 throws Exception

      Handle a SOCKS4/SOCKS4a response from the proxy server. Test the response buffer reply code and call `AbstractProxyLogicHandler.setHandshakeComplete()` if access is granted.
      Parameters:
        `buf` - the buffer holding the server response data.
      Throws:
        `exception` - if server response is malformed or if request is rejected by the proxy server.
        `Exception`

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.