Package io.testproject.sdk.internal.tcp
Class SocketManager
- java.lang.Object
-
- io.testproject.sdk.internal.tcp.SocketManager
-
public final class SocketManager extends java.lang.ObjectManages the development TCP socket connection.
-
-
Field Summary
Fields Modifier and Type Field Description static intCONNECTION_SLEEP_TIMEConnection validation sleep in milliseconds.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseSocket()Closes the TCP socket connection to the Agent.static SocketManagergetInstance()Static method to obtain a singleton instance of the class.booleanisOpen()Checks whether the socket is open or closed.voidopenSocket(java.lang.String host, int port, java.lang.String uuid)Opens a TCP socket connection to the Agent using provided host and port.
-
-
-
Field Detail
-
CONNECTION_SLEEP_TIME
public static final int CONNECTION_SLEEP_TIME
Connection validation sleep in milliseconds.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static SocketManager getInstance()
Static method to obtain a singleton instance of the class.- Returns:
- SocketManager instance.
-
closeSocket
public void closeSocket()
Closes the TCP socket connection to the Agent.
-
openSocket
public void openSocket(java.lang.String host, int port, java.lang.String uuid) throws AgentConnectExceptionOpens a TCP socket connection to the Agent using provided host and port. Does effectively nothing if already connected.- Parameters:
host- Host to connect.port- Port to connect.uuid- Uuid sent by the Agent to verify connection.- Throws:
AgentConnectException- When connection fails.
-
isOpen
public boolean isOpen()
Checks whether the socket is open or closed.- Returns:
- True if open, otherwise False.
-
-