io.netty.handler.proxy

## Class HttpProxyHandler

- java.lang.Object
- - io.netty.channel.ChannelHandlerAdapter
  - - io.netty.channel.ChannelInboundHandlerAdapter
    - - io.netty.channel.ChannelDuplexHandler
      - - io.netty.handler.proxy.ProxyHandler
        - - io.netty.handler.proxy.HttpProxyHandler

All Implemented Interfaces:
  io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

    public final class HttpProxyHandler
    extends ProxyHandler

### Nested Class Summary

Nested Classes
`static class` `HttpProxyHandler.HttpProxyConnectException` Specific case of a connection failure, which may include headers from the proxy.

### Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

`io.netty.channel.ChannelHandler.Sharable`

### Constructor Summary

Constructors
Constructor and Description
`HttpProxyHandler(SocketAddress proxyAddress)`
`HttpProxyHandler(SocketAddress proxyAddress, io.netty.handler.codec.http.HttpHeaders headers)`
`HttpProxyHandler(SocketAddress proxyAddress, io.netty.handler.codec.http.HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)`
`HttpProxyHandler(SocketAddress proxyAddress, String username, String password)`
`HttpProxyHandler(SocketAddress proxyAddress, String username, String password, io.netty.handler.codec.http.HttpHeaders headers)`
`HttpProxyHandler(SocketAddress proxyAddress, String username, String password, io.netty.handler.codec.http.HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `addCodec(io.netty.channel.ChannelHandlerContext ctx)` Adds the codec handlers required to communicate with the proxy server.
`String` `authScheme()` Returns the name of the authentication scheme in use.
`protected boolean` `handleResponse(io.netty.channel.ChannelHandlerContext ctx, Object response)` Handles the message received from the proxy server.
`protected Object` `newInitialMessage(io.netty.channel.ChannelHandlerContext ctx)` Returns a new message that is sent at first time when the connection to the proxy server has been established.
`String` `password()`
`String` `protocol()` Returns the name of the proxy protocol in use.
`protected void` `removeDecoder(io.netty.channel.ChannelHandlerContext ctx)` Removes the decoders added in `ProxyHandler.addCodec(ChannelHandlerContext)`.
`protected void` `removeEncoder(io.netty.channel.ChannelHandlerContext ctx)` Removes the encoders added in `ProxyHandler.addCodec(ChannelHandlerContext)`.
`String` `username()`

### Methods inherited from class io.netty.handler.proxy.ProxyHandler

`channelActive, channelInactive, channelRead, channelReadComplete, connect, connectFuture, connectTimeoutMillis, destinationAddress, exceptionCaught, exceptionMessage, flush, handlerAdded, isConnected, proxyAddress, sendToProxyServer, setConnectTimeoutMillis, write`

### Methods inherited from class io.netty.channel.ChannelDuplexHandler

`bind, close, deregister, disconnect, read`

### Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

`channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered`

### Methods inherited from class io.netty.channel.ChannelHandlerAdapter

`ensureNotSharable, handlerRemoved, isSharable`

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

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

### Methods inherited from interface io.netty.channel.ChannelHandler

`handlerRemoved`

### Constructor Detail

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress)

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress,
                            io.netty.handler.codec.http.HttpHeaders headers)

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress,
                            io.netty.handler.codec.http.HttpHeaders headers,
                            boolean ignoreDefaultPortsInConnectHostHeader)

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress,
                            String username,
                            String password)

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress,
                            String username,
                            String password,
                            io.netty.handler.codec.http.HttpHeaders headers)

#### HttpProxyHandler

    public HttpProxyHandler(SocketAddress proxyAddress,
                            String username,
                            String password,
                            io.netty.handler.codec.http.HttpHeaders headers,
                            boolean ignoreDefaultPortsInConnectHostHeader)

### Method Detail

#### protocol

    public String protocol()

Description copied from class: `ProxyHandler`
Returns the name of the proxy protocol in use.

Specified by:
  `protocol` in class `ProxyHandler`

#### authScheme

    public String authScheme()

Description copied from class: `ProxyHandler`
Returns the name of the authentication scheme in use.

Specified by:
  `authScheme` in class `ProxyHandler`

#### username

    public String username()

#### password

    public String password()

#### addCodec

    protected void addCodec(io.netty.channel.ChannelHandlerContext ctx)
                     throws Exception

Description copied from class: `ProxyHandler`
Adds the codec handlers required to communicate with the proxy server.

Specified by:
  `addCodec` in class `ProxyHandler`
Throws:
  `Exception`

#### removeEncoder

    protected void removeEncoder(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception

Description copied from class: `ProxyHandler`
Removes the encoders added in `ProxyHandler.addCodec(ChannelHandlerContext)`.

Specified by:
  `removeEncoder` in class `ProxyHandler`
Throws:
  `Exception`

#### removeDecoder

    protected void removeDecoder(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception

Description copied from class: `ProxyHandler`
Removes the decoders added in `ProxyHandler.addCodec(ChannelHandlerContext)`.

Specified by:
  `removeDecoder` in class `ProxyHandler`
Throws:
  `Exception`

#### newInitialMessage

    protected Object newInitialMessage(io.netty.channel.ChannelHandlerContext ctx)
                                throws Exception

Description copied from class: `ProxyHandler`
Returns a new message that is sent at first time when the connection to the proxy server has been established.

Specified by:
  `newInitialMessage` in class `ProxyHandler`
Returns:
  the initial message, or `null` if the proxy server is expected to send the first message instead
Throws:
  `Exception`

#### handleResponse

    protected boolean handleResponse(io.netty.channel.ChannelHandlerContext ctx,
                                     Object response)
                              throws Exception

Description copied from class: `ProxyHandler`
Handles the message received from the proxy server.

Specified by:
  `handleResponse` in class `ProxyHandler`
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`