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 byte
private ByteBuffer
private static final byte
private static final byte
private final InternalDataChannel
private final IOEventHandlerFactory
private static final int
private static final int
private static final byte
private final IOReactorConfig
private final IOSessionRequest
private SocksProxyProtocolHandler.State
private static final byte
private static final byte
private static final byte
-
Constructor Summary
ConstructorsConstructorDescriptionSocksProxyProtocolHandler
(InternalDataChannel dataChannel, IOSessionRequest sessionRequest, IOEventHandlerFactory eventHandlerFactory, IOReactorConfig reactorConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Triggered after the given session has been just created.private byte[]
void
disconnected
(IOSession session) Triggered when the given session has been terminated.void
Triggered when the given session throws a exception.private boolean
fillBuffer
(ByteChannel channel) void
inputReady
(IOSession session, ByteBuffer src) Triggered when the given session has input pending.void
outputReady
(IOSession session) Triggered when the given session is ready for output.private void
private void
setBufferLimit
(int newLimit) void
Triggered when the given session has timed out.private boolean
writeAndPrepareRead
(ByteChannel channel, int readSize) private boolean
writeBuffer
(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:IOEventHandler
Triggered after the given session has been just created.- Specified by:
connected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
IOException
-
outputReady
Description copied from interface:IOEventHandler
Triggered when the given session is ready for output.- Specified by:
outputReady
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
IOException
-
cred
- Throws:
IOException
-
inputReady
Description copied from interface:IOEventHandler
Triggered when the given session has input pending.- Specified by:
inputReady
in 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:IOEventHandler
Triggered when the given session has timed out.- Specified by:
timeout
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.timeout
- the timeout.- Throws:
IOException
-
exception
Description copied from interface:IOEventHandler
Triggered when the given session throws a exception.- Specified by:
exception
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-
disconnected
Description copied from interface:IOEventHandler
Triggered when the given session has been terminated.- Specified by:
disconnected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-