public interface Client
This is a low-level abstraction through which Catalyst clients connect to servers.
Users should never use this API directly.
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
close()
Closes the client.
|
CompletableFuture<Connection> |
connect(Address address)
Connects the client to the given address.
|
UUID |
id()
Returns the client ID.
|
UUID id()
The client ID is a globally unique UUID that identifies connections between this
Client and a remote Server.
When a client connects to a server, the client will establish the connection by sending the server its ID. This allows
the server to identify connected clients via Connection.id().
CompletableFuture<Connection> connect(Address address)
Once the client connects to the given address, the Connection will be established
by sharing the client's id() with the server and the returned future
will be completed. The resulting Connection.id() will equal the client id().
address - The address to which to connect.NullPointerException - if address is nullIllegalStateException - if not called from a Catalyst threadCompletableFuture<Void> close()
Before the client is closed, all Connections opened by the client will be closed
and any registered Connection.closeListener(java.util.function.Consumer)s will be invoked.
IllegalStateException - if not called from a Catalyst threadCopyright © 2013–2015. All rights reserved.