Top Description Inners Fields Constructors Methods
org.apache.hc.core5.reactor

pack-priv final Class SocksProxyProtocolHandler

extends Object
implements IOEventHandler
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.reactor.IOEventHandler
Imports
java.io.IOException, java.net.Inet4Address, .Inet6Address, .InetAddress, .InetSocketAddress, java.nio.BufferOverflowException, .ByteBuffer, java.nio.channels.ByteChannel, .SelectionKey, java.nio.charset.StandardCharsets, org.apache.hc.core5.http.nio.command.CommandSupport, org.apache.hc.core5.io.CloseMode, .SocketTimeoutExceptionFactory, org.apache.hc.core5.net.InetAddressUtils, org.apache.hc.core5.util.Timeout

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 and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private 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

AccessConstructor and Description
pack-priv
SocksProxyProtocolHandler(final InternalDataChannel dataChannel, final IOSessionRequest sessionRequest, final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig reactorConfig)

Method Summary

Modifier and TypeMethod and Description
public void
connected(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.connected.

Triggered after the given session has been just created.
private byte[]
cred(final String cred)

public void
disconnected(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Triggered when the given session has been terminated.
public void
exception(final IOSession
the I/O session.
session
,
final Exception cause)

Implements org.apache.hc.core5.reactor.IOEventHandler.exception.

Triggered when the given session throws a exception.
private boolean
fillBuffer(final ByteChannel channel)

public void
inputReady(final IOSession
the I/O session.
session
,
final ByteBuffer src)

Implements org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Triggered when the given session has input pending.
public void
outputReady(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Triggered when the given session is ready for output.
private void
private void
setBufferLimit(final int newLimit)

public void
timeout(final IOSession
the I/O session.
session
,
final Timeout
the timeout.
timeout
)

Implements org.apache.hc.core5.reactor.IOEventHandler.timeout.

Triggered when the given session has timed out.
private boolean
writeAndPrepareRead(final ByteChannel channel, final int readSize)

private boolean
writeBuffer(final ByteChannel channel)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ATYP_DOMAINNAMEback to summary
private static final byte ATYP_DOMAINNAME
bufferback to summary
private ByteBuffer buffer
CLIENT_VERSIONback to summary
private static final byte CLIENT_VERSION
COMMAND_CONNECTback to summary
private static final byte COMMAND_CONNECT
dataChannelback to summary
private final InternalDataChannel dataChannel
eventHandlerFactoryback to summary
private final IOEventHandlerFactory eventHandlerFactory
MAX_COMMAND_CONNECT_LENGTHback to summary
private static final int MAX_COMMAND_CONNECT_LENGTH
MAX_DNS_NAME_LENGTHback to summary
private static final int MAX_DNS_NAME_LENGTH
NO_AUTHENTICATION_REQUIREDback to summary
private static final byte NO_AUTHENTICATION_REQUIRED
reactorConfigback to summary
private final IOReactorConfig reactorConfig
sessionRequestback to summary
private final IOSessionRequest sessionRequest
stateback to summary
private SocksProxyProtocolHandler.State state
SUCCESSback to summary
private static final byte SUCCESS
USERNAME_PASSWORDback to summary
private static final byte USERNAME_PASSWORD
USERNAME_PASSWORD_VERSIONback to summary
private static final byte USERNAME_PASSWORD_VERSION

Constructor Detail

SocksProxyProtocolHandlerback to summary
pack-priv SocksProxyProtocolHandler(final InternalDataChannel dataChannel, final IOSessionRequest sessionRequest, final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig reactorConfig)

Method Detail

connectedback to summary
public void connected(final IOSession session) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.connected.

Doc from org.apache.hc.core5.reactor.IOEventHandler.connected.

Triggered after the given session has been just created.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
credback to summary
private byte[] cred(final String cred) throws IOException
disconnectedback to summary
public void disconnected(final IOSession session)

Implements org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Doc from org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Triggered when the given session has been terminated.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
exceptionback to summary
public void exception(final IOSession session, final Exception cause)

Implements org.apache.hc.core5.reactor.IOEventHandler.exception.

Doc from org.apache.hc.core5.reactor.IOEventHandler.exception.

Triggered when the given session throws a exception.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
fillBufferback to summary
private boolean fillBuffer(final ByteChannel channel) throws IOException
inputReadyback to summary
public void inputReady(final IOSession session, final ByteBuffer src) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Doc from org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Triggered when the given session has input pending.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
outputReadyback to summary
public void outputReady(final IOSession session) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Doc from org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Triggered when the given session is ready for output.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
prepareConnectCommandback to summary
private void prepareConnectCommand() throws IOException
setBufferLimitback to summary
private void setBufferLimit(final int newLimit)
timeoutback to summary
public void timeout(final IOSession session, final Timeout timeout) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.timeout.

Doc from org.apache.hc.core5.reactor.IOEventHandler.timeout.

Triggered when the given session has timed out.

Parameters
session:IOSession

the I/O session.

timeout:Timeout

the timeout.

Annotations
@Override
writeAndPrepareReadback to summary
private boolean writeAndPrepareRead(final ByteChannel channel, final int readSize) throws IOException
writeBufferback to summary
private boolean writeBuffer(final ByteChannel channel) throws IOException
org.apache.hc.core5.reactor back to summary

private final Enum SocksProxyProtocolHandler.State

extends Enum<SocksProxyProtocolHandler.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State
public static final SocksProxyProtocolHandler.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SocksProxyProtocolHandler.State
public static SocksProxyProtocolHandler.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMPLETEback to summary
public static final SocksProxyProtocolHandler.State COMPLETE
RECEIVE_ADDRESSback to summary
public static final SocksProxyProtocolHandler.State RECEIVE_ADDRESS
RECEIVE_ADDRESS_TYPEback to summary
public static final SocksProxyProtocolHandler.State RECEIVE_ADDRESS_TYPE
RECEIVE_AUTHback to summary
public static final SocksProxyProtocolHandler.State RECEIVE_AUTH
RECEIVE_AUTH_METHODback to summary
public static final SocksProxyProtocolHandler.State RECEIVE_AUTH_METHOD
RECEIVE_RESPONSE_CODEback to summary
public static final SocksProxyProtocolHandler.State RECEIVE_RESPONSE_CODE
SEND_AUTHback to summary
public static final SocksProxyProtocolHandler.State SEND_AUTH
SEND_CONNECTback to summary
public static final SocksProxyProtocolHandler.State SEND_CONNECT
SEND_USERNAME_PASSWORDback to summary
public static final SocksProxyProtocolHandler.State SEND_USERNAME_PASSWORD

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static SocksProxyProtocolHandler.State valueOf(String name)
valuesback to summary
public static SocksProxyProtocolHandler.State[] values()