GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Deprecated
  • Index
  • Search
  • Help
  • io.netty.handler.proxy
  • ProxyHandler

This view

  • Original page
  • New address

GeezerVison is showing netty.io — ProxyHandler (Netty API Reference (4.1.141.Final))

Class ProxyHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.proxy.ProxyHandler
All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler
Direct Known Subclasses:
HttpProxyHandler, Socks4ProxyHandler, Socks5ProxyHandler

public abstract class ProxyHandler extends ChannelDuplexHandler
A common abstraction for protocols that establish blind forwarding proxy tunnels.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface ChannelHandler

    ChannelHandler.Sharable
    Modifier and Type
    Interface
    Description
    static @interface 
    ChannelHandler.Sharable
    Indicates that the same instance of the annotated ChannelHandler can be added to one or more ChannelPipelines multiple times without a race condition.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ProxyHandler(SocketAddress proxyAddress)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    addCodec(ChannelHandlerContext ctx)
    Adds the codec handlers required to communicate with the proxy server.
    abstract String
    authScheme()
    Returns the name of the authentication scheme in use.
    final void
    channelActive(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelActive() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelInactive(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelInactive() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelRead(ChannelHandlerContext ctx, Object msg)
    Calls ChannelHandlerContext.fireChannelRead(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelReadComplete(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelReadComplete() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    final Future<Channel>
    connectFuture()
    Returns a Future that is notified when the connection to the destination has been established or the connection attempt has failed.
    final long
    connectTimeoutMillis()
    Returns the connect timeout in millis.
    final <T extends SocketAddress>
    T
    destinationAddress()
    Returns the address of the destination to connect to via the proxy server.
    final void
    exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
    Calls ChannelHandlerContext.fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline.
    protected final String
    exceptionMessage(String msg)
    Decorates the specified exception message with the common information such as the current protocol, authentication scheme, proxy address, and destination address.
    final void
    flush(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.flush() to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    final void
    handlerAdded(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    protected abstract boolean
    handleResponse(ChannelHandlerContext ctx, Object response)
    Handles the message received from the proxy server.
    void
    handlerRemoved(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    final boolean
    isConnected()
    Returns true if and only if the connection to the destination has been established successfully.
    protected abstract Object
    newInitialMessage(ChannelHandlerContext ctx)
    Returns a new message that is sent at first time when the connection to the proxy server has been established.
    abstract String
    protocol()
    Returns the name of the proxy protocol in use.
    final <T extends SocketAddress>
    T
    proxyAddress()
    Returns the address of the proxy server.
    protected abstract void
    removeDecoder(ChannelHandlerContext ctx)
    Removes the decoders added in addCodec(ChannelHandlerContext).
    protected abstract void
    removeEncoder(ChannelHandlerContext ctx)
    Removes the encoders added in addCodec(ChannelHandlerContext).
    protected final void
    sendToProxyServer(Object msg)
    Sends the specified message to the proxy server.
    final void
    setConnectTimeoutMillis(long connectTimeoutMillis)
    Sets the connect timeout in millis.
    final void
    write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
    Calls ChannelOutboundInvoker.write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelDuplexHandler

    bind, close, deregister, disconnect, read
    Modifier and Type
    Method
    Description
    void
    bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.bind(SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    close(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    deregister(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.deregister(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.disconnect(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    read(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.read() to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelInboundHandlerAdapter

    channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
    Modifier and Type
    Method
    Description
    void
    channelRegistered(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelRegistered() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    channelUnregistered(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelUnregistered() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    channelWritabilityChanged(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelWritabilityChanged() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    userEventTriggered(ChannelHandlerContext ctx, Object evt)
    Calls ChannelHandlerContext.fireUserEventTriggered(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelHandlerAdapter

    ensureNotSharable, isSharable
    Modifier and Type
    Method
    Description
    protected void
    ensureNotSharable()
    Throws IllegalStateException if ChannelHandlerAdapter.isSharable() returns true
    boolean
    isSharable()
    Return true if the implementation is ChannelHandler.Sharable and so can be added to different ChannelPipelines.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProxyHandler

      protected ProxyHandler(SocketAddress proxyAddress)
  • Method Details

    • protocol

      public abstract String protocol()
      Returns the name of the proxy protocol in use.
    • authScheme

      public abstract String authScheme()
      Returns the name of the authentication scheme in use.
    • proxyAddress

      public final <T extends SocketAddress> T proxyAddress()
      Returns the address of the proxy server.
    • destinationAddress

      public final <T extends SocketAddress> T destinationAddress()
      Returns the address of the destination to connect to via the proxy server.
    • isConnected

      public final boolean isConnected()
      Returns true if and only if the connection to the destination has been established successfully.
    • connectFuture

      public final Future<Channel> connectFuture()
      Returns a Future that is notified when the connection to the destination has been established or the connection attempt has failed.
    • connectTimeoutMillis

      public final long connectTimeoutMillis()
      Returns the connect timeout in millis. If the connection attempt to the destination does not finish within the timeout, the connection attempt will be failed.
    • setConnectTimeoutMillis

      public final void setConnectTimeoutMillis(long connectTimeoutMillis)
      Sets the connect timeout in millis. If the connection attempt to the destination does not finish within the timeout, the connection attempt will be failed.
    • handlerAdded

      public final void handlerAdded(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelHandlerAdapter
      Do nothing by default, sub-classes may override this method.
      Specified by:
      handlerAdded in interface ChannelHandler
      Overrides:
      handlerAdded in class ChannelHandlerAdapter
      Throws:
      Exception
    • handlerRemoved

      public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelHandlerAdapter
      Do nothing by default, sub-classes may override this method.
      Specified by:
      handlerRemoved in interface ChannelHandler
      Overrides:
      handlerRemoved in class ChannelHandlerAdapter
      Throws:
      Exception
    • addCodec

      protected abstract void addCodec(ChannelHandlerContext ctx) throws Exception
      Adds the codec handlers required to communicate with the proxy server.
      Throws:
      Exception
    • removeEncoder

      protected abstract void removeEncoder(ChannelHandlerContext ctx) throws Exception
      Removes the encoders added in addCodec(ChannelHandlerContext).
      Throws:
      Exception
    • removeDecoder

      protected abstract void removeDecoder(ChannelHandlerContext ctx) throws Exception
      Removes the decoders added in addCodec(ChannelHandlerContext).
      Throws:
      Exception
    • connect

      public final void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception
      Description copied from class: ChannelDuplexHandler
      Calls ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      connect in interface ChannelOutboundHandler
      Overrides:
      connect in class ChannelDuplexHandler
      Parameters:
      ctx - the ChannelHandlerContext for which the connect operation is made
      remoteAddress - the SocketAddress to which it should connect
      localAddress - the SocketAddress which is used as source on connect
      promise - the ChannelPromise to notify once the operation completes
      Throws:
      Exception - thrown if an error occurs
    • channelActive

      public final void channelActive(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelInboundHandlerAdapter
      Calls ChannelHandlerContext.fireChannelActive() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      channelActive in interface ChannelInboundHandler
      Overrides:
      channelActive in class ChannelInboundHandlerAdapter
      Throws:
      Exception
    • newInitialMessage

      protected abstract Object newInitialMessage(ChannelHandlerContext ctx) throws Exception
      Returns a new message that is sent at first time when the connection to the proxy server has been established.
      Returns:
      the initial message, or null if the proxy server is expected to send the first message instead
      Throws:
      Exception
    • sendToProxyServer

      protected final void sendToProxyServer(Object msg)
      Sends the specified message to the proxy server. Use this method to send a response to the proxy server in handleResponse(ChannelHandlerContext, Object).
    • channelInactive

      public final void channelInactive(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelInboundHandlerAdapter
      Calls ChannelHandlerContext.fireChannelInactive() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      channelInactive in interface ChannelInboundHandler
      Overrides:
      channelInactive in class ChannelInboundHandlerAdapter
      Throws:
      Exception
    • exceptionCaught

      public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
      Description copied from class: ChannelInboundHandlerAdapter
      Calls ChannelHandlerContext.fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      exceptionCaught in interface ChannelHandler
      Specified by:
      exceptionCaught in interface ChannelInboundHandler
      Overrides:
      exceptionCaught in class ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelRead

      public final void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
      Description copied from class: ChannelInboundHandlerAdapter
      Calls ChannelHandlerContext.fireChannelRead(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      channelRead in interface ChannelInboundHandler
      Overrides:
      channelRead in class ChannelInboundHandlerAdapter
      Throws:
      Exception
    • handleResponse

      protected abstract boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception
      Handles the message received from the proxy server.
      Returns:
      true if the connection to the destination has been established, false if the connection to the destination has not been established and more messages are expected from the proxy server
      Throws:
      Exception
    • exceptionMessage

      protected final String exceptionMessage(String msg)
      Decorates the specified exception message with the common information such as the current protocol, authentication scheme, proxy address, and destination address.
    • channelReadComplete

      public final void channelReadComplete(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelInboundHandlerAdapter
      Calls ChannelHandlerContext.fireChannelReadComplete() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      channelReadComplete in interface ChannelInboundHandler
      Overrides:
      channelReadComplete in class ChannelInboundHandlerAdapter
      Throws:
      Exception
    • write

      public final void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
      Description copied from class: ChannelDuplexHandler
      Calls ChannelOutboundInvoker.write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      write in interface ChannelOutboundHandler
      Overrides:
      write in class ChannelDuplexHandler
      Parameters:
      ctx - the ChannelHandlerContext for which the write operation is made
      msg - the message to write
      promise - the ChannelPromise to notify once the operation completes
      Throws:
      Exception - thrown if an error occurs
    • flush

      public final void flush(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ChannelDuplexHandler
      Calls ChannelHandlerContext.flush() to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.
      Specified by:
      flush in interface ChannelOutboundHandler
      Overrides:
      flush in class ChannelDuplexHandler
      Parameters:
      ctx - the ChannelHandlerContext for which the flush operation is made
      Throws:
      Exception - thrown if an error occurs
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.