Interface TcpConnection
- All Superinterfaces:
- Runnable
- All Known Subinterfaces:
- TcpConnectionInterceptor
- All Known Implementing Classes:
- TcpConnectionInterceptorSupport,- TcpConnectionSupport,- TcpNetConnection,- TcpNioConnection,- TcpNioSSLConnection
An abstraction over 
Socket and SocketChannel
 that sends Message objects by serializing the payload and streaming it to the
 destination. Requires a TcpListener to receive incoming messages.- Since:
- 2.0
- Author:
- Gary Russell
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the connection.Deserializer<?> Uses the deserializer to obtain the message payload from the connection's input stream.intgetPort()Serializer<?> Provides getters forSocketproperties.longbooleanisOpen()booleanisServer()voidConverts and sends the message.default voidSet the connection's input stream to end of stream.default voidDisable the socket's output stream.
- 
Method Details- 
closevoid close()Closes the connection.
- 
isOpenboolean isOpen()- Returns:
- true if the connection is open.
 
- 
send
- 
getPayload
- 
getHostNameString getHostName()- Returns:
- the host name
 
- 
getHostAddressString getHostAddress()- Returns:
- the host address
 
- 
getPortint getPort()- Returns:
- the port
 
- 
getConnectionIdString getConnectionId()- Returns:
- a string uniquely representing a connection.
 
- 
isServerboolean isServer()- Returns:
- True if connection is used once.
 
- 
getDeserializerDeserializer<?> getDeserializer()- Returns:
- the deserializer
 
- 
getSerializerSerializer<?> getSerializer()- Returns:
- the serializer
 
- 
getListener- Returns:
- this connection's listener
 
- 
incrementAndGetConnectionSequencelong incrementAndGetConnectionSequence()- Returns:
- the next sequence number for a message received on this socket
 
- 
getDeserializerStateKey- Returns:
- a key that can be used to reference state in a Deserializerthat 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.
 
- 
getSslSession- Returns:
- the SSLSessionassociated with this connection, if SSL is in use, null otherwise.
- Since:
- 4.2
 
- 
getSocketInfoSocketInfo getSocketInfo()Provides getters forSocketproperties.- Returns:
- the socketInfo - may be null, for example in interceptors; interceptors should override and delegate to the actual TcpConnection.
- Since:
- 4.3
 
- 
shutdownInputSet the connection's input stream to end of stream.- Throws:
- IOException- an IO Exception.
- Since:
- 5.2
 
- 
shutdownOutputDisable the socket's output stream.- Throws:
- IOException- an IO Exception
- Since:
- 5.2
 
 
-