Mercury-IM/core/src/main/java/org/mercury_im/messenger/core/ConnectionState.java

44 lines
1.1 KiB
Java

package org.mercury_im.messenger.core;
/**
* {@link MercuryConnection} modeled as a finite state machine.
* Below enums represent the states of the machine.
*/
public enum ConnectionState {
/**
* Connection is disconnected.
* This is the initial state of the machine.
*/
DISCONNECTED,
/**
* The connection is in the process of connecting to the server.
* This state can be reached by issuing a connect() call from within the {@link #DISCONNECTED}
* state.
*/
CONNECTING,
/**
* The connection is successfully connected to the server and the stream has been initiated.
* In this state the connection is ready to send and receive stanzas.
*/
CONNECTED,
/**
* The connection is in the process of shutting down.
*/
DISCONNECTING,
/**
* The device doesn't have usable network connectivity.
*/
WAITING_FOR_NETWORK,
/**
* The connection already (unsuccessfully) tried to connect, but failed due to lack of network
* connectivity and is now waiting to retry connecting.
*/
WAIRING_FOR_RETRY
}