public class OCSClient extends Object
Originally provided by Broadsoft. Edited for use in the Alpaca Library. The Request and Response are paired based upon ordering. This means that multiple requests sent through the same client risk contamination.
Constructor and Description |
---|
OCSClient() |
Modifier and Type | Method and Description |
---|---|
void |
connect(String host,
int port)
Connects to the specified Host and Port.
|
void |
disconnect()
Closes the current connection.
|
static Charset |
getEncoding()
Returns the
Charset used by the OCSClient. |
String |
getName() |
boolean |
isClosed()
Returns true iff the OCS socket is currently closed.
|
String |
sendMessage(String message)
Send a message through the OCS socket using the default timeout as
specified in the Alpaca properties file.
|
String |
sendMessage(String message,
long timeout)
Send a message through the OCS socket specifying the timeout.
|
void |
setName(String name) |
public static Charset getEncoding()
Charset
used by the OCSClient.public String getName()
public void setName(String name)
public void connect(String host, int port) throws IOException
host
- The host to connectport
- The port on the host to connectIOException
- Thrown if a fatal IO error occurspublic void disconnect() throws IOException
IOException
- Thrown if an issue occurs during disconnection.public boolean isClosed()
public String sendMessage(String message) throws IOException, InterruptedException
message
- The message to send through the socket.IOException
- Thrown if there is a socket error.InterruptedException
- Thrown if there is a synchronization issue.public String sendMessage(String message, long timeout) throws IOException, InterruptedException
message
- The message to send.timeout
- The message response timeout in milliseconds.IOException
- Thrown if there is a socket error.InterruptedException
- Thrown if there is a synchronization issue.Copyright © 2017 ECG. All rights reserved.