-
- All Superinterfaces:
ConnectionContext
,FlowContext
- All Known Implementing Classes:
SocketModem
public interface ModemContext<I,O> extends ConnectionContext, FlowContext
Network socket context that manages asynchronous I/O decoders and encoders for a non-blocking NIO network channel. AModemContext
is implicitly bound to aModem
, providing theModem
with the ability to modify itsFlowControl
state, enqueue read decoders and write encoders, tobecome
a different kind ofSocket
, and to close the socket.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
become(Socket socket)
Rebinds the underlyingSocketContext
to a newsocket
implementation, thereby changing theSocket
handler that receives network I/O callbacks.void
close()
Closes the underlying network socket.<I2 extends I>
voidread(Decoder<I2> decoder)
Enqueues a readdecoder
to which input data will be asynchronously fed.SocketSettings
socketSettings()
Returns the configuration parameters that govern the underlying network socket.<O2 extends O>
voidwrite(Encoder<?,O2> encoder)
Enqueues a writeencoder
from which output data will be asynchronously pulled.-
Methods inherited from interface swim.io.ConnectionContext
cipherSuite, isClient, isConnected, isSecure, isServer, localAddress, localCertificates, localPrincipal, remoteAddress, remoteCertificates, remotePrincipal, securityProtocol
-
Methods inherited from interface swim.io.FlowContext
flowControl, flowControl, flowControl
-
-
-
-
Method Detail
-
socketSettings
SocketSettings socketSettings()
Returns the configuration parameters that govern the underlying network socket.
-
read
<I2 extends I> void read(Decoder<I2> decoder)
Enqueues a readdecoder
to which input data will be asynchronously fed. The read flow control of the underlying network socket is automatically managed using the state of the readdecoder
. When the readdecoder
transitions into the done state, thedidRead
callback of the boundModem
will be invoked with the decoded result. If the readdecoder
transitions into the error state, then thedidFail
callback of the boundModem
will be invoked with the decode error.
-
write
<O2 extends O> void write(Encoder<?,O2> encoder)
Enqueues a writeencoder
from which output data will be asynchronously pulled. The write flow control of the underlying network socket is automatically managed using the state of the writeencoder
. When the writeencoder
transitions into the done state, thedidWrite
callback of the boundModem
will be invoked with the encoded result. If the writeencoder
transitions into the error state, then thedidFail
callback of the boundModem
will be invoked with the encode error.
-
become
void become(Socket socket)
Rebinds the underlyingSocketContext
to a newsocket
implementation, thereby changing theSocket
handler that receives network I/O callbacks.
-
close
void close()
Closes the underlying network socket.
-
-