Package com.kristensoft.kdc
Interface TcpClientEventHandler
-
- All Known Implementing Classes:
TcpClientEventAdapter
public interface TcpClientEventHandlerDefines event callbacks for monitoring the operation of aTcpClient.A TCP client event handler may be registered with a client to receive notifications about connection lifecycle events, reconnect attempts, sent and received agents, and received replies. Implementing this interface is optional and is not required for normal TCP client operation.
Applications interested in only a subset of these events may extend
TcpClientEventAdapterinstead of implementing every method in this interface.- Author:
- Charles B. Kozoyed
- See Also:
TcpClient,TcpClientEventAdapter,TcpServer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonConnecting(TcpClient tcpClient)Called when the TCP client begins attempting to establish a connection.voidonConnectionAttemptAborted(TcpClient tcpClient)Called when a TCP connection attempt is aborted.voidonConnectionClosed(TcpClient tcpClient)Called when the TCP client's connection is closed.voidonConnectionDropped(TcpClient tcpClient, String msg, Exception ex)Called when an established TCP connection is dropped.voidonConnectionEstablished(TcpClient tcpClient)Called when the TCP client establishes a connection.voidonConnectionFailed(TcpClient tcpClient)Called when a TCP connection attempt fails.voidonReceivedAgent(Agent agent)Called when an agent is received by the TCP client.voidonReceivedReply(Reply reply)Called when a reply is received by the TCP client.voidonReconnecting(TcpClient tcpClient)Called when the TCP client begins attempting to reconnect.voidonSendingAsyncAgent(Agent agent)Called when the TCP client is sending an asynchronous agent.voidonSendingSyncAgent(Agent agent)Called when the TCP client is sending a synchronous agent.voidonSocketCreated(TcpClient tcpClient)Called when a socket has been created for the TCP client.voidonWaitingToReconnect(TcpClient tcpClient, long waitTime)Called when the TCP client is waiting before another reconnection attempt.
-
-
-
Method Detail
-
onSocketCreated
void onSocketCreated(TcpClient tcpClient)
Called when a socket has been created for the TCP client.- Parameters:
tcpClient- the TCP client for which the socket was created
-
onConnecting
void onConnecting(TcpClient tcpClient)
Called when the TCP client begins attempting to establish a connection.- Parameters:
tcpClient- the TCP client attempting to connect
-
onReconnecting
void onReconnecting(TcpClient tcpClient)
Called when the TCP client begins attempting to reconnect.- Parameters:
tcpClient- the TCP client attempting to reconnect
-
onConnectionEstablished
void onConnectionEstablished(TcpClient tcpClient)
Called when the TCP client establishes a connection.- Parameters:
tcpClient- the TCP client that established the connection
-
onConnectionFailed
void onConnectionFailed(TcpClient tcpClient)
Called when a TCP connection attempt fails.- Parameters:
tcpClient- the TCP client whose connection attempt failed
-
onConnectionDropped
void onConnectionDropped(TcpClient tcpClient, String msg, Exception ex)
Called when an established TCP connection is dropped.- Parameters:
tcpClient- the TCP client whose connection was droppedmsg- the message describing the connection dropex- the exception associated with the connection drop
-
onConnectionClosed
void onConnectionClosed(TcpClient tcpClient)
Called when the TCP client's connection is closed.- Parameters:
tcpClient- the TCP client whose connection was closed
-
onConnectionAttemptAborted
void onConnectionAttemptAborted(TcpClient tcpClient)
Called when a TCP connection attempt is aborted.- Parameters:
tcpClient- the TCP client whose connection attempt was aborted
-
onReceivedAgent
void onReceivedAgent(Agent agent)
Called when an agent is received by the TCP client.This callback provides notification of received agents independently of normal agent dispatch to registered API implementations.
- Parameters:
agent- the agent received by the TCP client
-
onSendingSyncAgent
void onSendingSyncAgent(Agent agent)
Called when the TCP client is sending a synchronous agent.- Parameters:
agent- the synchronous agent being sent
-
onReceivedReply
void onReceivedReply(Reply reply)
Called when a reply is received by the TCP client.- Parameters:
reply- the reply received by the TCP client
-
onSendingAsyncAgent
void onSendingAsyncAgent(Agent agent)
Called when the TCP client is sending an asynchronous agent.- Parameters:
agent- the asynchronous agent being sent
-
onWaitingToReconnect
void onWaitingToReconnect(TcpClient tcpClient, long waitTime)
Called when the TCP client is waiting before another reconnection attempt.- Parameters:
tcpClient- the TCP client waiting to reconnectwaitTime- the reconnect delay in milliseconds
-
-