-
- 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. AModemContextis implicitly bound to aModem, providing theModemwith the ability to modify itsFlowControlstate, enqueue read decoders and write encoders, tobecomea different kind ofSocket, and to close the socket.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbecome(Socket socket)Rebinds the underlyingSocketContextto a newsocketimplementation, thereby changing theSockethandler that receives network I/O callbacks.voidclose()Closes the underlying network socket.<I2 extends I>
voidread(swim.codec.Decoder<I2> decoder)Enqueues a readdecoderto which input data will be asynchronously fed.SocketSettingssocketSettings()Returns the configuration parameters that govern the underlying network socket.<O2 extends O>
voidwrite(swim.codec.Encoder<?,O2> encoder)Enqueues a writeencoderfrom 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(swim.codec.Decoder<I2> decoder)
Enqueues a readdecoderto 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 readdecodertransitions into the done state, thedidReadcallback of the boundModemwill be invoked with the decoded result. If the readdecodertransitions into the error state, then thedidFailcallback of the boundModemwill be invoked with the decode error.
-
write
<O2 extends O> void write(swim.codec.Encoder<?,O2> encoder)
Enqueues a writeencoderfrom 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 writeencodertransitions into the done state, thedidWritecallback of the boundModemwill be invoked with the encoded result. If the writeencodertransitions into the error state, then thedidFailcallback of the boundModemwill be invoked with the encode error.
-
become
void become(Socket socket)
Rebinds the underlyingSocketContextto a newsocketimplementation, thereby changing theSockethandler that receives network I/O callbacks.
-
close
void close()
Closes the underlying network socket.
-
-