- java.lang.Object
-
- swim.io.mqtt.AbstractMqttSocket<I,O>
-
- All Implemented Interfaces:
FlowContext
,IpContext
,MqttSocket<I,O>
public abstract class AbstractMqttSocket<I,O> extends Object implements MqttSocket<I,O>, IpContext, FlowContext
-
-
Field Summary
Fields Modifier and Type Field Description protected MqttSocketContext<I,O>
context
-
Constructor Summary
Constructors Constructor Description AbstractMqttSocket()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
become(IpSocket socket)
String
cipherSuite()
Returns the cryptographic cipher suite used by the underlying network connection.void
close()
void
didBecome(IpSocket socket)
void
didConnect()
void
didDisconnect()
void
didFail(Throwable error)
void
didRead(MqttPacket<? extends I> packet)
void
didSecure()
void
didTimeout()
void
didWrite(MqttPacket<? extends O> packet)
void
doRead()
void
doWrite()
FlowControl
flowControl()
Returns the currentFlowControl
state of the underlying network channel.void
flowControl(FlowControl flowControl)
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.FlowControl
flowControl(FlowModifier flowModifier)
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.long
idleTimeout()
boolean
isClient()
Returnstrue
if the underlying network channel initiated an outgoing connection.boolean
isConnected()
Returnstrue
if the underlying network channel is currently connected.boolean
isSecure()
Returnstrue
if the underlying network transport is encrypted.boolean
isServer()
Returnstrue
if the underlying network channel accepted an incoming connection.InetSocketAddress
localAddress()
Returns the IP address and port of the local endpoint of the underlying network connection.Collection<Certificate>
localCertificates()
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection.Principal
localPrincipal()
Returns the authenticated identity of the local endpoint of the underlying network connection.MqttSettings
mqttSettings()
MqttSocketContext<I,O>
mqttSocketContext()
<I2 extends I>
voidread(Decoder<I2> content)
InetSocketAddress
remoteAddress()
Returns the IP address and port of the remote endpoint of the underlying network connection.Collection<Certificate>
remoteCertificates()
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection.Principal
remotePrincipal()
Returns the authenticated identity of the remote endpoint of the underlying network connection.String
securityProtocol()
Returns the name of the transport-layer security protocol used by the underlying network connection.void
setMqttSocketContext(MqttSocketContext<I,O> context)
void
willBecome(IpSocket socket)
void
willConnect()
void
willSecure()
<O2 extends O>
voidwrite(MqttPacket<O2> packet)
-
-
-
Field Detail
-
context
protected MqttSocketContext<I,O> context
-
-
Method Detail
-
mqttSocketContext
public MqttSocketContext<I,O> mqttSocketContext()
- Specified by:
mqttSocketContext
in interfaceMqttSocket<I,O>
-
setMqttSocketContext
public void setMqttSocketContext(MqttSocketContext<I,O> context)
- Specified by:
setMqttSocketContext
in interfaceMqttSocket<I,O>
-
idleTimeout
public long idleTimeout()
- Specified by:
idleTimeout
in interfaceMqttSocket<I,O>
-
doRead
public void doRead()
- Specified by:
doRead
in interfaceMqttSocket<I,O>
-
didRead
public void didRead(MqttPacket<? extends I> packet)
- Specified by:
didRead
in interfaceMqttSocket<I,O>
-
doWrite
public void doWrite()
- Specified by:
doWrite
in interfaceMqttSocket<I,O>
-
didWrite
public void didWrite(MqttPacket<? extends O> packet)
- Specified by:
didWrite
in interfaceMqttSocket<I,O>
-
willConnect
public void willConnect()
- Specified by:
willConnect
in interfaceMqttSocket<I,O>
-
didConnect
public void didConnect()
- Specified by:
didConnect
in interfaceMqttSocket<I,O>
-
willSecure
public void willSecure()
- Specified by:
willSecure
in interfaceMqttSocket<I,O>
-
didSecure
public void didSecure()
- Specified by:
didSecure
in interfaceMqttSocket<I,O>
-
willBecome
public void willBecome(IpSocket socket)
- Specified by:
willBecome
in interfaceMqttSocket<I,O>
-
didBecome
public void didBecome(IpSocket socket)
- Specified by:
didBecome
in interfaceMqttSocket<I,O>
-
didTimeout
public void didTimeout()
- Specified by:
didTimeout
in interfaceMqttSocket<I,O>
-
didDisconnect
public void didDisconnect()
- Specified by:
didDisconnect
in interfaceMqttSocket<I,O>
-
didFail
public void didFail(Throwable error)
- Specified by:
didFail
in interfaceMqttSocket<I,O>
-
isConnected
public boolean isConnected()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel is currently connected.- Specified by:
isConnected
in interfaceIpContext
-
isClient
public boolean isClient()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel initiated an outgoing connection.
-
isServer
public boolean isServer()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel accepted an incoming connection.
-
isSecure
public boolean isSecure()
Description copied from interface:IpContext
Returnstrue
if the underlying network transport is encrypted.
-
securityProtocol
public String securityProtocol()
Description copied from interface:IpContext
Returns the name of the transport-layer security protocol used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocol
in interfaceIpContext
-
cipherSuite
public String cipherSuite()
Description copied from interface:IpContext
Returns the cryptographic cipher suite used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuite
in interfaceIpContext
-
localAddress
public InetSocketAddress localAddress()
Description copied from interface:IpContext
Returns the IP address and port of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
localAddress
in interfaceIpContext
-
localPrincipal
public Principal localPrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipal
in interfaceIpContext
-
localCertificates
public Collection<Certificate> localCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificates
in interfaceIpContext
-
remoteAddress
public InetSocketAddress remoteAddress()
Description copied from interface:IpContext
Returns the IP address and port of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
remoteAddress
in interfaceIpContext
-
remotePrincipal
public Principal remotePrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipal
in interfaceIpContext
-
remoteCertificates
public Collection<Certificate> remoteCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificates
in interfaceIpContext
-
flowControl
public FlowControl flowControl()
Description copied from interface:FlowContext
Returns the currentFlowControl
state of the underlying network channel.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContext
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContext
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.- Specified by:
flowControl
in interfaceFlowContext
-
mqttSettings
public MqttSettings mqttSettings()
-
write
public <O2 extends O> void write(MqttPacket<O2> packet)
-
become
public void become(IpSocket socket)
-
close
public void close()
-
-