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.TransportListener
s can be registered in order to get notifications from transport events.
Functionalities provided by this interface are
- Getting the
Method
viagetMethod()
- Getting the
TransportClient.State
viagetState()
- Adding and removing
TransportClient.TransportListener
s 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 enum
Represents the connection state of the client.static interface
A TransportListener gets informed about client transport events. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(TransportClient.TransportListener listener) Adds a newTransportClient.TransportListener
to the transport client.void
connect()
Connects the client to the server.void
Disconnects the client from the server.Return the cryptographic client id of this client instance.getState()
void
Removes the givenTransportClient.TransportListener
from the list of listeners.
-
Method Details
-
getMethod
Method getMethod()- Returns:
- The connection
Method
being used.
-
getState
TransportClient.State getState()- Returns:
- The connection
TransportClient.State
of the client.
-
addListener
Adds a newTransportClient.TransportListener
to the transport client.- Parameters:
listener
- theTransportClient.TransportListener
that should be registered
-
removeListener
Removes the givenTransportClient.TransportListener
from the list of listeners.- Parameters:
listener
- theTransportClient.TransportListener
which 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
-