Class ProxyConnector

  • All Implemented Interfaces:
    IoConnector, IoService

    public class ProxyConnector
    extends AbstractIoConnector
    ProxyConnector.java - Decorator for SocketConnector to provide proxy support, as suggested by MINA list discussions.

    Operates by intercepting connect requests and replacing the endpoint address with the proxy address, then adding a ProxyFilter as the first IoFilter which performs any necessary handshaking with the proxy before allowing data to flow normally. During the handshake, any outgoing write requests are buffered.

    Since:
    MINA 2.0.0-M3
    Author:
    Apache MINA Project
    See Also:
    Proxy reconnection, Proxy support
    • Constructor Detail

      • ProxyConnector

        public ProxyConnector()
        Creates a new proxy connector.
      • ProxyConnector

        public ProxyConnector​(SocketConnector connector)
        Creates a new proxy connector.
        Parameters:
        connector - Connector used to establish proxy connections.
      • ProxyConnector

        public ProxyConnector​(SocketConnector connector,
                              IoSessionConfig config,
                              Executor executor)
        Creates a new proxy connector.
        Parameters:
        connector - The Connector used to establish proxy connections.
        config - The session confiugarion to use
        executor - The associated executor
    • Method Detail

      • getSessionConfig

        public IoSessionConfig getSessionConfig()
        Returns:
        the default configuration of the new IoSessions created by this service.
      • setProxyIoSession

        public void setProxyIoSession​(ProxyIoSession proxyIoSession)
        Sets the proxy session object of this connector.
        Parameters:
        proxyIoSession - the configuration of this connector.
      • connect0

        protected ConnectFuture connect0​(SocketAddress remoteAddress,
                                         SocketAddress localAddress,
                                         IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
        Connects to the specified address. If communication starts successfully, events are fired to the connector's handler.
        Specified by:
        connect0 in class AbstractIoConnector
        Parameters:
        remoteAddress - the remote address to connect to
        localAddress - the local address
        sessionInitializer - the session initializer
        Returns:
        ConnectFuture that will tell the result of the connection attempt
      • cancelConnectFuture

        public void cancelConnectFuture()
        Cancels the real connection when reconnection is in use.
      • fireConnected

        protected ConnectFuture fireConnected​(IoSession session)
        Fires the connection event on the real future to notify the client.
        Parameters:
        session - the current session
        Returns:
        the future holding the connected session