public abstract class AbstractProxyHandler extends AbstractStreamHandler
Modifier | Constructor and Description |
---|---|
protected |
AbstractProxyHandler(ISessionConfig config,
ISessionStructureFactory factory)
Constructs a proxy connection handler with the default (10 seconds)
connection timeout, configuration and factory.
|
Modifier and Type | Method and Description |
---|---|
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.
|
AbstractProxyHandler |
connectionTimeout(long connectionTimeout)
Configures the proxy connection timeout.
|
void |
event(SessionEvent event)
Called to notify about a change of the associated session state.
|
ISessionStructureFactory |
getFactory()
Returns the factory object that will be used to configure the internal
structure of the associated session.
|
protected abstract void |
handleReady()
Called to initiate the connection process via a proxy protocol
|
void |
timer(Object event)
Called to notify about an expiration of the timer identified by the
specified event object.
|
available, getSession, setSession
event, exception, getConfig, getName, incident, read, read, timer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
event, exception, getConfig, getName, incident, read, read, read, timer
read, read
protected AbstractProxyHandler(ISessionConfig config, ISessionStructureFactory factory)
NOTE: The connection timeout will have no effect if the associated session does not support a session timer.
config
- 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 factorypublic AbstractProxyHandler connectionTimeout(long connectionTimeout)
NOTE: The connection timeout will have no effect if the associated session does not support a session timer.
connectionTimeout
- the proxy connection timeout in milliseconds, or 0
to wait an infinite amount of time for establishing
the HTTP tunnelIllegalArgumentException
- if the connection timeout is negativepublic int available(ByteBuffer data, boolean flipped)
AbstractStreamHandler
read
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 IStreamReader
available
in class AbstractStreamHandler
data
- the input buffer.flipped
- specifies the current mode of the bufferprotected abstract void handleReady() throws Exception
Exception
- if a failure occurredpublic void event(SessionEvent event)
IHandler
event
in interface IHandler
event
in class AbstractHandler
event
- an event related with the change of the session stateSessionEvent
public void timer(Object event)
IHandler
timer
in interface IHandler
timer
in class AbstractHandler
event
- the event object that identifies the timerpublic ISessionStructureFactory getFactory()
IHandler
getFactory
in interface IHandler
getFactory
in class AbstractHandler
ISessionStructureFactory
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.