Package org.apache.hc.core5.reactor
Class SocksProxyProtocolHandler
java.lang.Object
org.apache.hc.core5.reactor.SocksProxyProtocolHandler
- All Implemented Interfaces:
IOEventHandler
Implements the client side of SOCKS protocol version 5 as per https://tools.ietf.org/html/rfc1928. Supports SOCKS username/password
authentication as per https://tools.ietf.org/html/rfc1929.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byteprivate ByteBufferprivate static final byteprivate static final byteprivate final InternalDataChannelprivate final IOEventHandlerFactoryprivate static final intprivate static final intprivate static final byteprivate final IOReactorConfigprivate final IOSessionRequestprivate SocksProxyProtocolHandler.Stateprivate static final byteprivate static final byteprivate static final byte -
Constructor Summary
ConstructorsConstructorDescriptionSocksProxyProtocolHandler(InternalDataChannel dataChannel, IOSessionRequest sessionRequest, IOEventHandlerFactory eventHandlerFactory, IOReactorConfig reactorConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidTriggered after the given session has been just created.private byte[]voiddisconnected(IOSession session) Triggered when the given session has been terminated.voidTriggered when the given session throws a exception.private booleanfillBuffer(ByteChannel channel) voidinputReady(IOSession session, ByteBuffer src) Triggered when the given session has input pending.voidoutputReady(IOSession session) Triggered when the given session is ready for output.private voidprivate voidsetBufferLimit(int newLimit) voidTriggered when the given session has timed out.private booleanwriteAndPrepareRead(ByteChannel channel, int readSize) private booleanwriteBuffer(ByteChannel channel)
-
Field Details
-
MAX_DNS_NAME_LENGTH
private static final int MAX_DNS_NAME_LENGTH- See Also:
-
MAX_COMMAND_CONNECT_LENGTH
private static final int MAX_COMMAND_CONNECT_LENGTH- See Also:
-
CLIENT_VERSION
private static final byte CLIENT_VERSION- See Also:
-
NO_AUTHENTICATION_REQUIRED
private static final byte NO_AUTHENTICATION_REQUIRED- See Also:
-
USERNAME_PASSWORD
private static final byte USERNAME_PASSWORD- See Also:
-
USERNAME_PASSWORD_VERSION
private static final byte USERNAME_PASSWORD_VERSION- See Also:
-
SUCCESS
private static final byte SUCCESS- See Also:
-
COMMAND_CONNECT
private static final byte COMMAND_CONNECT- See Also:
-
ATYP_DOMAINNAME
private static final byte ATYP_DOMAINNAME- See Also:
-
dataChannel
-
sessionRequest
-
eventHandlerFactory
-
reactorConfig
-
buffer
-
state
-
-
Constructor Details
-
SocksProxyProtocolHandler
SocksProxyProtocolHandler(InternalDataChannel dataChannel, IOSessionRequest sessionRequest, IOEventHandlerFactory eventHandlerFactory, IOReactorConfig reactorConfig)
-
-
Method Details
-
connected
Description copied from interface:IOEventHandlerTriggered after the given session has been just created.- Specified by:
connectedin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
IOException
-
outputReady
Description copied from interface:IOEventHandlerTriggered when the given session is ready for output.- Specified by:
outputReadyin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
IOException
-
cred
- Throws:
IOException
-
inputReady
Description copied from interface:IOEventHandlerTriggered when the given session has input pending.- Specified by:
inputReadyin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
IOException
-
prepareConnectCommand
- Throws:
IOException
-
setBufferLimit
private void setBufferLimit(int newLimit) -
writeAndPrepareRead
- Throws:
IOException
-
writeBuffer
- Throws:
IOException
-
fillBuffer
- Throws:
IOException
-
timeout
Description copied from interface:IOEventHandlerTriggered when the given session has timed out.- Specified by:
timeoutin interfaceIOEventHandler- Parameters:
session- the I/O session.timeout- the timeout.- Throws:
IOException
-
exception
Description copied from interface:IOEventHandlerTriggered when the given session throws a exception.- Specified by:
exceptionin interfaceIOEventHandler- Parameters:
session- the I/O session.
-
disconnected
Description copied from interface:IOEventHandlerTriggered when the given session has been terminated.- Specified by:
disconnectedin interfaceIOEventHandler- Parameters:
session- the I/O session.
-