public interface TcpConnection extends Runnable
Socket and SocketChannel
that sends Message objects by serializing the payload and streaming it to the
destination. Requires a TcpListener to receive incoming messages.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
String |
getConnectionId() |
Deserializer<?> |
getDeserializer() |
Object |
getDeserializerStateKey() |
String |
getHostAddress() |
String |
getHostName() |
TcpListener |
getListener() |
Object |
getPayload()
Uses the deserializer to obtain the message payload
from the connection's input stream.
|
int |
getPort() |
Serializer<?> |
getSerializer() |
SocketInfo |
getSocketInfo()
Provides getters for
Socket properties. |
SSLSession |
getSslSession() |
long |
incrementAndGetConnectionSequence() |
boolean |
isOpen() |
boolean |
isServer() |
void |
send(Message<?> message)
Converts and sends the message.
|
default void |
shutdownInput()
Set the connection's input stream to end of stream.
|
default void |
shutdownOutput()
Disable the socket's output stream.
|
void close()
boolean isOpen()
void send(Message<?> message)
message - The message,@Nullable Object getPayload()
String getHostName()
String getHostAddress()
int getPort()
String getConnectionId()
boolean isServer()
Deserializer<?> getDeserializer()
Serializer<?> getSerializer()
@Nullable TcpListener getListener()
long incrementAndGetConnectionSequence()
@Nullable Object getDeserializerStateKey()
Deserializer that
maintains state for this connection. Currently, this would be the InputStream
associated with the connection, but the object should be treated as opaque
and ONLY used as a key.@Nullable SSLSession getSslSession()
SSLSession associated with this connection, if SSL is in use,
null otherwise.SocketInfo getSocketInfo()
Socket properties.default void shutdownInput()
throws IOException
IOException - an IO Exception.default void shutdownOutput()
throws IOException
IOException - an IO Exception