Class AbstractProxyLogicHandler

  • All Implemented Interfaces:
    ProxyLogicHandler
    Direct Known Subclasses:
    AbstractHttpLogicHandler, AbstractSocksLogicHandler

    public abstract class AbstractProxyLogicHandler
    extends java.lang.Object
    implements ProxyLogicHandler
    AbstractProxyLogicHandler.java - Helper class to handle proxy handshaking logic. Derived classes implement proxy type specific logic.

    Based upon SSLHandler from mina-filter-ssl.

    Since:
    MINA 2.0.0-M3
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • proxyIoSession

        private ProxyIoSession proxyIoSession
        Object that contains all the proxy authentication session informations.
      • writeRequestQueue

        private java.util.Queue<AbstractProxyLogicHandler.Event> writeRequestQueue
        Queue of write events which occurred before the proxy handshake had completed.
      • handshakeComplete

        private boolean handshakeComplete
        Has the handshake been completed.
    • Method Detail

      • getSession

        protected IoSession getSession()
        Returns:
        the session.
      • writeData

        protected WriteFuture writeData​(IoFilter.NextFilter nextFilter,
                                        IoBuffer data)
        Writes data to the proxy server.
        Parameters:
        nextFilter - the next filter
        data - Data buffer to be written.
        Returns:
        A Future for the write operation
      • isHandshakeComplete

        public boolean isHandshakeComplete()
        Description copied from interface: ProxyLogicHandler
        Tests if handshake process is complete.
        Specified by:
        isHandshakeComplete in interface ProxyLogicHandler
        Returns:
        true if handshaking is complete and data can be sent through the proxy.
      • setHandshakeComplete

        protected final void setHandshakeComplete()
        Signals that the handshake has finished.
      • flushPendingWriteRequests

        protected void flushPendingWriteRequests()
                                          throws java.lang.Exception
        Send any write requests which were queued whilst waiting for handshaking to complete.
        Throws:
        java.lang.Exception - If we can't flush the pending write requests
      • enqueueWriteRequest

        public void enqueueWriteRequest​(IoFilter.NextFilter nextFilter,
                                        WriteRequest writeRequest)
        Enqueue a message to be written once handshaking is complete.
        Specified by:
        enqueueWriteRequest in interface ProxyLogicHandler
        Parameters:
        nextFilter - the next filter in filter chain
        writeRequest - the data to be written
      • closeSession

        protected void closeSession​(java.lang.String message,
                                    java.lang.Throwable t)
        Closes the session.
        Parameters:
        message - the error message
        t - the exception which caused the session closing
      • closeSession

        protected void closeSession​(java.lang.String message)
        Closes the session.
        Parameters:
        message - the error message