java.lang.Object
swim.io.IpSocketModem<I,O>
- All Implemented Interfaces:
FlowContext,IpContext,IpModemContext<I,,O> IpSocket
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRebinds the underlyingIpSocketContextto a newsocketimplementation, thereby changing theIpSockethandler that receives network I/O callbacks.Returns the cryptographic cipher suite used by the underlying network connection.voidclose()Closes the underlying network socket.voidLifecycle callback invoked by the socket context after it hasbecomea newsocketimplementation.voidLifecycle callback invoked by the socket context after the underlying network socket has opened a connection.voidLifecycle callback invoked by the socket context after the underlying network connection has disconnected.voidLifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror.voidLifecycle callback invoked by the socket context after the underlying network socket has established a secure connection.voidLifecycle callback invoked by the socket context after the underlying network connection has timed out.voiddidWrite()I/O callback invoked by the socket context after the underlying network socket has completed writing all data in itsoutputBuffer.voiddoRead()I/O callback invoked by the socket context asking thisIpSocketto read input data out of the socket context'sinputBuffer.voiddoWrite()I/O callback invoked by the socket context asking thisIpSocketto write output data into the socket context'soutputBuffer.Returns the currentFlowControlstate of the underlying network channel.voidflowControl(FlowControl flowControl) Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.flowControl(FlowModifier flowModifier) Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.longReturns the number of idle milliseconds after which thisIpSocketshould be closed due to inactivity.Returns the configuration parameters that govern the underlying network socket.Returns the network socket context to which thisIpSocketis bound; returnsnullif thisIpSocketis unbound.booleanisClient()Returnstrueif the underlying network channel initiated an outgoing connection.booleanReturnstrueif the underlying network channel is currently connected.booleanisSecure()Returnstrueif the underlying network transport is encrypted.booleanisServer()Returnstrueif the underlying network channel accepted an incoming connection.Returns the IP address and port of the local endpoint of the underlying network connection.Returns the certificate chain used to authenticate the local endpoint of the underlying network connection.Returns the authenticated identity of the local endpoint of the underlying network connection.<I2 extends I>
voidEnqueues a readdecoderto which input data will be asynchronously fed.Returns the IP address and port of the remote endpoint of the underlying network connection.Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection.Returns the authenticated identity of the remote endpoint of the underlying network connection.Returns the name of the transport-layer security protocol used by the underlying network connection.voidsetIpSocketContext(IpSocketContext context) Sets the network socket context to which thisIpSocketis bound.voidwillBecome(IpSocket socket) Lifecycle callback invoked by the socket context before it hasbecomea newsocketimplementation.voidLifecycle callback invoked by the socket context before the underlying network socket attempts to open a connection.voidLifecycle callback invoked by the socket context before the underlying network socket establishes a secure connection.<O2 extends O>
voidEnqueues a writeencoderfrom which output data will be asynchronously pulled.
-
Field Details
-
context
-
-
Constructor Details
-
IpSocketModem
-
-
Method Details
-
ipSocketContext
Description copied from interface:IpSocketReturns the network socket context to which thisIpSocketis bound; returnsnullif thisIpSocketis unbound.- Specified by:
ipSocketContextin interfaceIpSocket
-
setIpSocketContext
Description copied from interface:IpSocketSets the network socket context to which thisIpSocketis bound.- Specified by:
setIpSocketContextin interfaceIpSocket
-
isConnected
public boolean isConnected()Description copied from interface:IpContextReturnstrueif the underlying network channel is currently connected.- Specified by:
isConnectedin interfaceIpContext
-
isClient
public boolean isClient()Description copied from interface:IpContextReturnstrueif the underlying network channel initiated an outgoing connection. -
isServer
public boolean isServer()Description copied from interface:IpContextReturnstrueif the underlying network channel accepted an incoming connection. -
isSecure
public boolean isSecure()Description copied from interface:IpContextReturnstrueif the underlying network transport is encrypted. -
securityProtocol
Description copied from interface:IpContextReturns the name of the transport-layer security protocol used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocolin interfaceIpContext
-
cipherSuite
Description copied from interface:IpContextReturns the cryptographic cipher suite used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuitein interfaceIpContext
-
localAddress
Description copied from interface:IpContextReturns the IP address and port of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
localAddressin interfaceIpContext
-
localPrincipal
Description copied from interface:IpContextReturns the authenticated identity of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipalin interfaceIpContext
-
localCertificates
Description copied from interface:IpContextReturns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificatesin interfaceIpContext
-
remoteAddress
Description copied from interface:IpContextReturns the IP address and port of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
remoteAddressin interfaceIpContext
-
remotePrincipal
Description copied from interface:IpContextReturns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipalin interfaceIpContext
-
remoteCertificates
Description copied from interface:IpContextReturns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificatesin interfaceIpContext
-
ipSettings
Description copied from interface:IpModemContextReturns the configuration parameters that govern the underlying network socket.- Specified by:
ipSettingsin interfaceIpModemContext<I,O>
-
read
Description copied from interface:IpModemContextEnqueues 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 boundIpModemwill be invoked with the decoded result. If the readdecodertransitions into the error state, then thedidFailcallback of the boundIpModemwill be invoked with the decode error.- Specified by:
readin interfaceIpModemContext<I,O>
-
write
Description copied from interface:IpModemContextEnqueues 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 boundIpModemwill be invoked with the encoded result. If the writeencodertransitions into the error state, then thedidFailcallback of the boundIpModemwill be invoked with the encode error.- Specified by:
writein interfaceIpModemContext<I,O>
-
idleTimeout
public long idleTimeout()Description copied from interface:IpSocketReturns the number of idle milliseconds after which thisIpSocketshould be closed due to inactivity. Returns-1if a default idle timeout should be used. Returns0if the underlying network socket should not time out.- Specified by:
idleTimeoutin interfaceIpSocket
-
doRead
public void doRead()Description copied from interface:IpSocketI/O callback invoked by the socket context asking thisIpSocketto read input data out of the socket context'sinputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadcalls. -
doWrite
public void doWrite()Description copied from interface:IpSocketI/O callback invoked by the socket context asking thisIpSocketto write output data into the socket context'soutputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls. -
didWrite
public void didWrite()Description copied from interface:IpSocketI/O callback invoked by the socket context after the underlying network socket has completed writing all data in itsoutputBuffer. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls. -
willConnect
public void willConnect()Description copied from interface:IpSocketLifecycle callback invoked by the socket context before the underlying network socket attempts to open a connection.- Specified by:
willConnectin interfaceIpSocket
-
didConnect
public void didConnect()Description copied from interface:IpSocketLifecycle callback invoked by the socket context after the underlying network socket has opened a connection.- Specified by:
didConnectin interfaceIpSocket
-
willSecure
public void willSecure()Description copied from interface:IpSocketLifecycle callback invoked by the socket context before the underlying network socket establishes a secure connection.- Specified by:
willSecurein interfaceIpSocket
-
didSecure
public void didSecure()Description copied from interface:IpSocketLifecycle callback invoked by the socket context after the underlying network socket has established a secure connection. -
willBecome
Description copied from interface:IpSocketLifecycle callback invoked by the socket context before it hasbecomea newsocketimplementation.- Specified by:
willBecomein interfaceIpSocket
-
didBecome
Description copied from interface:IpSocketLifecycle callback invoked by the socket context after it hasbecomea newsocketimplementation. -
didTimeout
public void didTimeout()Description copied from interface:IpSocketLifecycle callback invoked by the socket context after the underlying network connection has timed out. The socket will automatically be closed.- Specified by:
didTimeoutin interfaceIpSocket
-
didDisconnect
public void didDisconnect()Description copied from interface:IpSocketLifecycle callback invoked by the socket context after the underlying network connection has disconnected.- Specified by:
didDisconnectin interfaceIpSocket
-
didFail
Description copied from interface:IpSocketLifecycle callback invoked by the socket context when the underlying network socket fails by throwing anerror. The socket will automatically be closed. -
flowControl
Description copied from interface:FlowContextReturns the currentFlowControlstate of the underlying network channel.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
Description copied from interface:FlowContextEnqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
Description copied from interface:FlowContextEnqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.- Specified by:
flowControlin interfaceFlowContext
-
become
Description copied from interface:IpModemContextRebinds the underlyingIpSocketContextto a newsocketimplementation, thereby changing theIpSockethandler that receives network I/O callbacks.- Specified by:
becomein interfaceIpModemContext<I,O>
-
close
public void close()Description copied from interface:IpModemContextCloses the underlying network socket.- Specified by:
closein interfaceIpModemContext<I,O>
-