Enum Class ConnectionState
- All Implemented Interfaces:
Serializable,Comparable<ConnectionState>,Constable
A server progresses through states in the following normal lifecycle: it
begins in
DISCONNECTED, advances to CONNECTING while the socket is
being established,
then to CONNECTED once the socket is open (but before authentication
completes),
and finally to AUTHENTICATED when the server is fully operational and
ready to
exchange messages. If the connection drops unexpectedly from
AUTHENTICATED or
CONNECTED, the state transitions to RECONNECTING and the
client attempts
to re-establish the connection. If authentication fails at any point, the
state becomes
AUTH_FAILED and no further connection attempts are made.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAuthentication failed; no further connection attempts will be made.Fully connected and authenticated; messages may be sent and received.The socket connection is established; awaiting authentication.A socket connection is being established.No connection has been established.The connection was lost and a reconnection attempt is in progress. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisActive()Returns whether the connection is established and ready for message transport.static ConnectionStateReturns the enum constant of this class with the specified name.static ConnectionState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DISCONNECTED
No connection has been established.This is the initial state before any connection attempt has been made.
-
CONNECTING
A socket connection is being established.This state precedes
CONNECTEDand indicates that the client is actively attempting to open a socket to the bridge network. -
CONNECTED
The socket connection is established; awaiting authentication.This is an intermediate state. The socket is open but the handshake has not yet completed, so messages cannot be sent or received until the state advances to
AUTHENTICATED. -
AUTHENTICATED
Fully connected and authenticated; messages may be sent and received.This is the only state in which
isActive()returnstrue. All message channels are operational while the server remains in this state. -
RECONNECTING
The connection was lost and a reconnection attempt is in progress.This state occurs after an unexpected disconnect from
AUTHENTICATEDorCONNECTED. The client will attempt to re-establish the connection and progress back throughCONNECTINGandCONNECTED. -
AUTH_FAILED
Authentication failed; no further connection attempts will be made.If the server reaches this state, verify that the configured secret key matches on both the Velocity proxy and the backend server.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isActive
public boolean isActive()Returns whether the connection is established and ready for message transport.- Returns:
trueif and only if the current state isAUTHENTICATED,falseotherwise
-