Interface TransportClient
public interface TransportClient
A TransportClient is able to establish a connection with a sever in order to exchange messages.
It sends messages in form of plain text and receive messages. Furthermore,
TransportClient.TransportListeners can be registered in order to get notifications from transport events.
Functionalities provided by this interface are
- Getting the
MethodviagetMethod() - Getting the
TransportClient.StateviagetState() - Adding and removing
TransportClient.TransportListeners viaaddListener(TransportListener)andremoveListener(TransportListener) - Trigger the client to connect to the server via
connect() - Trigger the client to disconnect from the server via
disconnect()
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRepresents the connection state of the client.static interfaceA TransportListener gets informed about client transport events. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(TransportClient.TransportListener listener) Adds a newTransportClient.TransportListenerto the transport client.voidconnect()Connects the client to the server.voidDisconnects the client from the server.Return the cryptographic client id of this client instance.getState()voidRemoves the givenTransportClient.TransportListenerfrom the list of listeners.
-
Method Details
-
getMethod
Method getMethod()- Returns:
- The connection
Methodbeing used.
-
getState
TransportClient.State getState()- Returns:
- The connection
TransportClient.Stateof the client.
-
addListener
Adds a newTransportClient.TransportListenerto the transport client.- Parameters:
listener- theTransportClient.TransportListenerthat should be registered
-
removeListener
Removes the givenTransportClient.TransportListenerfrom the list of listeners.- Parameters:
listener- theTransportClient.TransportListenerwhich should be removed
-
connect
Connects the client to the server.- Throws:
IOException- If the connection process failed.
-
disconnect
void disconnect()Disconnects the client from the server. -
getClientId
String getClientId()Return the cryptographic client id of this client instance.- Returns:
- the client id
-