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:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler
Handler that establishes a blind forwarding proxy tunnel using
HTTP/1.1 CONNECT request. It can be used to
establish plaintext or secure tunnels.
HTTP users who need to connect to a message-forwarding HTTP proxy agent instead of a tunneling proxy should not use this handler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSpecific case of a connection failure, which may include headers from the proxy.Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionHttpProxyHandler(SocketAddress proxyAddress) HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers) HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader) HttpProxyHandler(SocketAddress proxyAddress, String username, String password) HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers) HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds the codec handlers required to communicate with the proxy server.Returns the name of the authentication scheme in use.protected booleanhandleResponse(ChannelHandlerContext ctx, Object response) Handles the message received from the proxy server.protected ObjectReturns a new message that is sent at first time when the connection to the proxy server has been established.password()protocol()Returns the name of the proxy protocol in use.protected voidRemoves the decoders added inProxyHandler.addCodec(ChannelHandlerContext).protected voidRemoves the encoders added inProxyHandler.addCodec(ChannelHandlerContext).username()Methods inherited from class ProxyHandler
channelActive, channelInactive, channelRead, channelReadComplete, connect, connectFuture, connectTimeoutMillis, destinationAddress, exceptionCaught, exceptionMessage, flush, handlerAdded, isConnected, proxyAddress, sendToProxyServer, setConnectTimeoutMillis, writeMethods inherited from class ChannelDuplexHandler
bind, close, deregister, disconnect, readMethods inherited from class ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerRemoved
-
Constructor Details
-
HttpProxyHandler
-
HttpProxyHandler
-
HttpProxyHandler
public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader) -
HttpProxyHandler
-
HttpProxyHandler
public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers) -
HttpProxyHandler
public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
-
-
Method Details
-
protocol
Description copied from class:ProxyHandlerReturns the name of the proxy protocol in use.- Specified by:
protocolin classProxyHandler
-
authScheme
Description copied from class:ProxyHandlerReturns the name of the authentication scheme in use.- Specified by:
authSchemein classProxyHandler
-
username
-
password
-
addCodec
Description copied from class:ProxyHandlerAdds the codec handlers required to communicate with the proxy server.- Specified by:
addCodecin classProxyHandler- Throws:
Exception
-
removeEncoder
Description copied from class:ProxyHandlerRemoves the encoders added inProxyHandler.addCodec(ChannelHandlerContext).- Specified by:
removeEncoderin classProxyHandler- Throws:
Exception
-
removeDecoder
Description copied from class:ProxyHandlerRemoves the decoders added inProxyHandler.addCodec(ChannelHandlerContext).- Specified by:
removeDecoderin classProxyHandler- Throws:
Exception
-
newInitialMessage
Description copied from class:ProxyHandlerReturns a new message that is sent at first time when the connection to the proxy server has been established.- Specified by:
newInitialMessagein classProxyHandler- Returns:
- the initial message, or
nullif the proxy server is expected to send the first message instead - Throws:
Exception
-
handleResponse
Description copied from class:ProxyHandlerHandles the message received from the proxy server.- Specified by:
handleResponsein classProxyHandler- Returns:
trueif the connection to the destination has been established,falseif the connection to the destination has not been established and more messages are expected from the proxy server- Throws:
Exception
-