public final class Socks5ProxyHandler extends ProxyHandler
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
AUTH_PASSWORD |
private java.lang.String |
decoderName |
private java.lang.String |
encoderName |
private static Socks5InitialRequest |
INIT_REQUEST_NO_AUTH |
private static Socks5InitialRequest |
INIT_REQUEST_PASSWORD |
private java.lang.String |
password |
private static java.lang.String |
PROTOCOL |
private java.lang.String |
username |
AUTH_NONE
Constructor and Description |
---|
Socks5ProxyHandler(java.net.SocketAddress proxyAddress) |
Socks5ProxyHandler(java.net.SocketAddress proxyAddress,
java.lang.String username,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCodec(ChannelHandlerContext ctx)
Adds the codec handlers required to communicate with the proxy server.
|
java.lang.String |
authScheme()
Returns the name of the authentication scheme in use.
|
protected boolean |
handleResponse(ChannelHandlerContext ctx,
java.lang.Object response)
Handles the message received from the proxy server.
|
protected java.lang.Object |
newInitialMessage(ChannelHandlerContext ctx)
Returns a new message that is sent at first time when the connection to the proxy server has been established.
|
java.lang.String |
password() |
java.lang.String |
protocol()
Returns the name of the proxy protocol in use.
|
protected void |
removeDecoder(ChannelHandlerContext ctx)
Removes the decoders added in
ProxyHandler.addCodec(ChannelHandlerContext) . |
protected void |
removeEncoder(ChannelHandlerContext ctx)
Removes the encoders added in
ProxyHandler.addCodec(ChannelHandlerContext) . |
private void |
sendConnectCommand(ChannelHandlerContext ctx) |
private Socks5AuthMethod |
socksAuthMethod() |
java.lang.String |
username() |
channelActive, channelInactive, channelRead, channelReadComplete, connect, connectFuture, connectTimeoutMillis, destinationAddress, exceptionCaught, exceptionMessage, flush, handlerAdded, isConnected, proxyAddress, sendToProxyServer, setConnectTimeoutMillis, write
bind, close, deregister, disconnect, read
channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
private static final java.lang.String PROTOCOL
private static final java.lang.String AUTH_PASSWORD
private static final Socks5InitialRequest INIT_REQUEST_NO_AUTH
private static final Socks5InitialRequest INIT_REQUEST_PASSWORD
private final java.lang.String username
private final java.lang.String password
private java.lang.String decoderName
private java.lang.String encoderName
public Socks5ProxyHandler(java.net.SocketAddress proxyAddress)
public Socks5ProxyHandler(java.net.SocketAddress proxyAddress, java.lang.String username, java.lang.String password)
public java.lang.String protocol()
ProxyHandler
protocol
in class ProxyHandler
public java.lang.String authScheme()
ProxyHandler
authScheme
in class ProxyHandler
public java.lang.String username()
public java.lang.String password()
protected void addCodec(ChannelHandlerContext ctx) throws java.lang.Exception
ProxyHandler
addCodec
in class ProxyHandler
java.lang.Exception
protected void removeEncoder(ChannelHandlerContext ctx) throws java.lang.Exception
ProxyHandler
ProxyHandler.addCodec(ChannelHandlerContext)
.removeEncoder
in class ProxyHandler
java.lang.Exception
protected void removeDecoder(ChannelHandlerContext ctx) throws java.lang.Exception
ProxyHandler
ProxyHandler.addCodec(ChannelHandlerContext)
.removeDecoder
in class ProxyHandler
java.lang.Exception
protected java.lang.Object newInitialMessage(ChannelHandlerContext ctx) throws java.lang.Exception
ProxyHandler
newInitialMessage
in class ProxyHandler
null
if the proxy server is expected to send the first message insteadjava.lang.Exception
protected boolean handleResponse(ChannelHandlerContext ctx, java.lang.Object response) throws java.lang.Exception
ProxyHandler
handleResponse
in class ProxyHandler
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 serverjava.lang.Exception
private Socks5AuthMethod socksAuthMethod()
private void sendConnectCommand(ChannelHandlerContext ctx) throws java.lang.Exception
java.lang.Exception