public abstract class AbstractSocksProxyHandler extends AbstractProxyHandler
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSocksProxyHandler(InetSocketAddress address,
ISessionConfig config,
ISessionStructureFactory factory)
Constructs a SOCKS proxy connection handler with the specified destination
address, the default (10 seconds) connection timeout, configuration and factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReplyListener(ISocksReplyListener listener)
Adds a listener for replies sent from the SOCKS server
|
int |
available(byte[] data,
int off,
int len)
Determines how many bytes can be read from the input buffer after
receiving new data from the remote end.
|
int |
available(ByteBuffer data,
boolean flipped)
Determines how many bytes can be read from the input buffer after
receiving new data from the remote end.
|
void |
event(SessionEvent event)
Called to notify about a change of the associated session state.
|
InetSocketAddress |
getAddress()
Returns the destination address.
|
ISocksReply[] |
getReplies()
Returns replies sent from the SOCKS server.
|
protected void |
handleReady()
Called to initiate the connection process via a proxy protocol
|
void |
read(byte[] data)
Called when new bytes were read from the input buffer.
|
void |
read(ByteBuffer data)
Called when new bytes were read from the input buffer.
|
void |
read(Object msg)
Called when a new message was read and decoded from the input buffer.
|
connectionTimeout, getFactory, timergetSession, setSessionevent, exception, getConfig, getName, incident, timerprotected AbstractSocksProxyHandler(InetSocketAddress address, ISessionConfig config, ISessionStructureFactory factory)
NOTE: The connection timeout will have no effect if the associated session does not support a session timer.
address - the destination addressconfig - the session configuration object, or null to
use the default configurationfactory - the factory that will be used to configure the
internal structure of the associated session, or
null to use the default factoryIllegalArgumentException - if the address is nullpublic InetSocketAddress getAddress()
public ISocksReply[] getReplies()
public void addReplyListener(ISocksReplyListener listener)
listener - a listener for repliespublic int available(ByteBuffer data, boolean flipped)
AbstractStreamHandlerread method.
This method is called only if the input buffer is not backed by an array.
The type of the input buffer is specified by the implementation of the
ISessionStructureFactory returned by the
getFactory method.
The inner state of the passed buffer cannot be changed by this method.
This implementation always returns total number of bytes in the buffer.
available in interface IStreamReaderavailable in class AbstractProxyHandlerdata - the input buffer.flipped - specifies the current mode of the bufferpublic int available(byte[] data,
int off,
int len)
AbstractStreamHandlerread method.
This method is called only if the input buffer is backed by an array. The
type of the input buffer is specified by the implementation of the
ISessionStructureFactory returned by the
getFactory method.
The content of the passed buffer cannot be changed by this method.
This implementation always returns total number of bytes in the array
(i.e. the len value).
available in interface IStreamReaderavailable in class AbstractStreamHandlerdata - the array that backs the input buffer.off - the offset of the arraylen - the number of the bytes in the arraypublic void read(ByteBuffer data)
AbstractHandlerByteBuffer objects or when the associated
session is configured to optimize data copying and uses an allocator
supporting the releasing of no longer used buffers
The passed byte buffer can be safely stored or modified by this method as it will not be used by the caller. However, if the associated session is configured to optimize data copying and uses an allocator supporting the releasing of no longer used buffers it may be required to release it in this method unless the original buffer has been already released by one of the associated decoders.
By default it simply passes the data value to the
IHandler.read(Object) method.
read in interface IHandlerread in interface IStreamReaderread in class AbstractHandlerdata - bytes that was read from the input buffer.public void read(byte[] data)
AbstractHandlerread methods are
met.
The passed array can be safely stored or modified by this method as it will not be used by the caller.
By default it simply passes the data value to the
IHandler.read(Object) method.
read in interface IHandlerread in interface IStreamReaderread in class AbstractHandlerdata - bytes that was read from the input buffer.protected void handleReady()
throws Exception
AbstractProxyHandlerhandleReady in class AbstractProxyHandlerException - if a failure occurredpublic void read(Object msg)
IHandlerbyte[] and ByteBuffer.msg - the message that was read and decoded from the input buffer.public void event(SessionEvent event)
IHandlerevent in interface IHandlerevent in class AbstractProxyHandlerevent - an event related with the change of the session stateSessionEventCopyright © 2017–2022 SNF4J.ORG. All rights reserved.