public class ClientConnection extends Object
| Constructor and Description |
|---|
ClientConnection()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(String endpointSent)
Connects to a specified address, in the format of "address" or "address:port".
|
void |
disconnect()
Handles the disconnection from the currently active client.
|
String |
getConnectStatus()
Returns the status of the current connection.
|
boolean |
isConnected()
Flag indicating whether or not the connection is active.
|
ClientConnection |
messageReceived(Consumer<net.scattersphere.data.message.JobMessage> onMessage) |
ClientConnection |
onConnect(Consumer<ClientConnectionState> onConnect) |
void |
sendMessage(byte[] data)
Sends a command payload to the server, packetizing the data (header with length), and sending it across the wire
in a
Buffer. |
public ClientConnection onConnect(Consumer<ClientConnectionState> onConnect)
public ClientConnection messageReceived(Consumer<net.scattersphere.data.message.JobMessage> onMessage)
public void connect(String endpointSent)
endpointSent - The endpoint address to connect to.public void disconnect()
public void sendMessage(byte[] data)
Buffer.data - A byte[] array of data to send.public String getConnectStatus()
String containing a human-readable representation of the connection status.public boolean isConnected()
true if the connection is active, false otherwise.Copyright © 2015. All rights reserved.