public static class ProxyConnectionFactory.ProxyEndPoint extends Object implements EndPoint
Constructor and Description |
---|
ProxyEndPoint(EndPoint endp,
InetSocketAddress remote,
InetSocketAddress local) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close any backing stream associated with the endpoint
|
int |
fill(ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.
|
void |
fillInterested(Callback callback)
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer) would return data or EOF. |
boolean |
flush(ByteBuffer... buffer)
Flush data from the passed header/buffer to this endpoint.
|
Connection |
getConnection() |
long |
getCreatedTimeStamp() |
long |
getIdleTimeout()
Get the max idle time in ms.
|
InetSocketAddress |
getLocalAddress() |
InetSocketAddress |
getRemoteAddress() |
Object |
getTransport() |
boolean |
isFillInterested() |
boolean |
isInputShutdown()
Test if the input is shutdown.
|
boolean |
isOpen() |
boolean |
isOptimizedForDirectBuffers()
Is the endpoint optimized for DirectBuffer usage
|
boolean |
isOutputShutdown()
Test if output is shutdown.
|
void |
onClose()
Callback method invoked when this
EndPoint is close. |
void |
onOpen()
Callback method invoked when this
EndPoint is opened. |
void |
setConnection(Connection connection) |
void |
setIdleTimeout(long idleTimeout)
Set the idle timeout.
|
void |
shutdownOutput()
Shutdown the output.
|
void |
upgrade(Connection newConnection)
Upgrade connections.
|
void |
write(Callback callback,
ByteBuffer... buffers)
Writes the given buffers via
EndPoint.flush(ByteBuffer...) and invokes callback methods when either
all the data has been flushed or an error occurs. |
public ProxyEndPoint(EndPoint endp, InetSocketAddress remote, InetSocketAddress local)
public boolean isOptimizedForDirectBuffers()
EndPoint
isOptimizedForDirectBuffers
in interface EndPoint
public InetSocketAddress getLocalAddress()
getLocalAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface EndPoint
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public long getCreatedTimeStamp()
getCreatedTimeStamp
in interface EndPoint
public void shutdownOutput()
EndPoint
This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.
If the endpoint has EndPoint.isInputShutdown()
true, then this call has the same effect
as EndPoint.close()
.
shutdownOutput
in interface EndPoint
public boolean isOutputShutdown()
EndPoint
EndPoint.shutdownOutput()
or EndPoint.close()
.isOutputShutdown
in interface EndPoint
public boolean isInputShutdown()
EndPoint
EndPoint.fill(ByteBuffer)
. Once the input is shutdown, all calls to
EndPoint.fill(ByteBuffer)
will return -1, until such time as the
end point is close, when they will return EofException
.isInputShutdown
in interface EndPoint
public void close()
EndPoint
public int fill(ByteBuffer buffer) throws IOException
EndPoint
fill
in interface EndPoint
buffer
- The buffer to fill. The position and limit are modified during the fill. After the
operation, the position is unchanged and the limit is increased to reflect the new data filled.int
value indicating the number of bytes
filled or -1 if EOF is read or the input is shutdown.IOException
- if the endpoint is closed.public boolean flush(ByteBuffer... buffer) throws IOException
EndPoint
flush
in interface EndPoint
buffer
- the buffers to flushIOException
- If the endpoint is closed or output is shutdown.public Object getTransport()
getTransport
in interface EndPoint
public long getIdleTimeout()
EndPoint
The max idle time is the time the endpoint can be idle before extraordinary handling takes place.
getIdleTimeout
in interface EndPoint
public void setIdleTimeout(long idleTimeout)
EndPoint
setIdleTimeout
in interface EndPoint
idleTimeout
- the idle timeout in MS. Timeout <= 0 implies an infinite timeoutpublic void fillInterested(Callback callback) throws ReadPendingException
EndPoint
Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer)
would return data or EOF.
fillInterested
in interface EndPoint
callback
- the callback to call when an error occurs or we are readable.ReadPendingException
- if another read operation is concurrent.public boolean isFillInterested()
isFillInterested
in interface EndPoint
EndPoint.fillInterested(Callback)
has been called, but EndPoint.fill(ByteBuffer)
has not yet
been calledpublic void write(Callback callback, ByteBuffer... buffers) throws WritePendingException
EndPoint
Writes the given buffers via EndPoint.flush(ByteBuffer...)
and invokes callback methods when either
all the data has been flushed or an error occurs.
write
in interface EndPoint
callback
- the callback to call when an error occurs or the write completed.buffers
- one or more ByteBuffer
s that will be flushed.WritePendingException
- if another write operation is concurrent.public Connection getConnection()
getConnection
in interface EndPoint
Connection
associated with this EndPoint
EndPoint.setConnection(Connection)
public void setConnection(Connection connection)
setConnection
in interface EndPoint
connection
- the Connection
associated with this EndPoint
EndPoint.getConnection()
,
EndPoint.upgrade(Connection)
public void onOpen()
EndPoint
Callback method invoked when this EndPoint
is opened.
onOpen
in interface EndPoint
EndPoint.onClose()
public void onClose()
EndPoint
Callback method invoked when this EndPoint
is close.
onClose
in interface EndPoint
EndPoint.onOpen()
public void upgrade(Connection newConnection)
EndPoint
Connection.UpgradeFrom
then
a prefilled buffer is requested and passed to the newConnection if it is an instance
of Connection.UpgradeTo
Copyright © 1995-2016 Webtide. All Rights Reserved.