-
- All Known Implementing Classes:
AbstractIpModem,HttpClientModem,HttpServerModem,MqttSocketModem,WebSocketModem
public interface IpModem<I,O>Network socket binding that provides asynchronous I/O decoders and encoders for a non-blocking NIO network channel.An
IpModeminterfaces with the underlying asynchronous networking system via anIpModemContext. The modem context invokes I/O callbacks on theIpModemwhen the underlying network socket is ready to perform I/O operations permitted by the socket context'sFlowControl.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddidBecome(IpSocket socket)Lifecycle callback invoked by the modem context after it hasbecomea newsocketimplementation.voiddidConnect()Lifecycle callback invoked by the modem context after the underlying network socket has opened a connection.voiddidDisconnect()Lifecycle callback invoked by the socket context after the underlying network connection has disconnected.voiddidFail(Throwable error)Lifecycle callback invoked by the modem context when the underlying network socket fails by throwing anerror.voiddidRead(I input)I/O callback invoked by the modem context with the completed value of the current readDecoderafter it has transitioned to the done state.voiddidSecure()Lifecycle callback invoked by the modem context after the underlying network socket has established a secure connection.voiddidTimeout()Lifecycle callback invoked by the modem context after the underlying network connection has timed out.voiddidWrite(O output)I/O callback invoked by the modem context with the completed value of the current writeEncoderafter it has transitioned to the done state.voiddoRead()voiddoWrite()longidleTimeout()Returns the number of idle milliseconds after which thisIpModemshould be closed due to inactivity.IpModemContext<I,O>ipModemContext()Returns the socket modem context to which thisIpModemis bound; returnsnullif thisIpModemis unbound.voidsetIpModemContext(IpModemContext<I,O> context)Sets the socket modem context to which thisIpModemis bound.voidwillBecome(IpSocket socket)Lifecycle callback invoked by the modem context before it hasbecomea newsocketimplementation.voidwillConnect()Lifecycle callback invoked by the modem context before the underlying network socket attempts to open a connection.voidwillSecure()Lifecycle callback invoked by the modem context before the underlying network socket establishes a secure connection.
-
-
-
Method Detail
-
ipModemContext
IpModemContext<I,O> ipModemContext()
Returns the socket modem context to which thisIpModemis bound; returnsnullif thisIpModemis unbound.
-
setIpModemContext
void setIpModemContext(IpModemContext<I,O> context)
Sets the socket modem context to which thisIpModemis bound.
-
idleTimeout
long idleTimeout()
Returns the number of idle milliseconds after which thisIpModemshould be closed due to inactivity. Returns-1if a default idle timeout should be used. Returns0if the underlying network socket should not time out.
-
doRead
void doRead()
I/O callback invoked by the modem context asking thisIpModemto provide an inputDecoderby invoking the modem context'sreadmethod. The modem context will asynchronously feed input data to the provided readDecoderuntil it transitions out of the cont state. The read flow control of the underlying network socket is automatically managed by the modem context using the state of the readDecoder. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadordidReadcalls.
-
didRead
void didRead(I input)
I/O callback invoked by the modem context with the completed value of the current readDecoderafter it has transitioned to the done state. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadordidReadcalls.
-
doWrite
void doWrite()
I/O callback invoked by the modem context asking thisIpModemto provide an outputEncoderby invoking the modem context'swritemethod. The modem context will asynchronously pull output data from the provided writeEncoderuntil it transitions out of the cont state. The write flow control of the underlying network socket is automatically managed by the modem context using the state of the writeEncoder. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.
-
didWrite
void didWrite(O output)
I/O callback invoked by the modem context with the completed value of the current writeEncoderafter it has transitioned to the done state. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdodWriteordidWritecalls.
-
willConnect
void willConnect()
Lifecycle callback invoked by the modem context before the underlying network socket attempts to open a connection.
-
didConnect
void didConnect()
Lifecycle callback invoked by the modem context after the underlying network socket has opened a connection.
-
willSecure
void willSecure()
Lifecycle callback invoked by the modem context before the underlying network socket establishes a secure connection.
-
didSecure
void didSecure()
Lifecycle callback invoked by the modem context after the underlying network socket has established a secure connection.
-
willBecome
void willBecome(IpSocket socket)
Lifecycle callback invoked by the modem context before it hasbecomea newsocketimplementation.
-
didBecome
void didBecome(IpSocket socket)
Lifecycle callback invoked by the modem context after it hasbecomea newsocketimplementation.
-
didTimeout
void didTimeout()
Lifecycle callback invoked by the modem context after the underlying network connection has timed out. The modem will automatically be closed.
-
didDisconnect
void didDisconnect()
Lifecycle callback invoked by the socket context after the underlying network connection has disconnected.
-
didFail
void didFail(Throwable error)
Lifecycle callback invoked by the modem context when the underlying network socket fails by throwing anerror. The modem will automatically be closed.
-
-