public boolean close(@NotNull CloseReason closeReason) {
        if (isSessionOpen) {
            // Note that it is acceptable to complete/close the connection multiple times
            // so that it is unnecessary to update isSessionOpen atomically
            isSessionOpen = false;
            if (connection == null) {
                LOGGER.warn("The connection is missing for the user session: {}", this);
            } else {
                connection.close(closeReason);
            }
            return true;
        }
        return false;
    }
A session cannot reopen once closed, but the connection can close and reconnect.

@return true if the session was online
turms-gateway/src/main/java/im/turms/gateway/access/client/common/UserSession.java