class ConnectedState implements BoltStateMachineState {

    @Override
    public BoltStateMachineState process( RequestMessage message, StateMachineContext context ) throws BoltConnectionFatality
    {
        assertInitialized();
        if ( message instanceof InitMessage )
        {
            InitMessage initMessage = (InitMessage) message;
            String userAgent = initMessage.userAgent();
            Map<String,Object> authToken = initMessage.authToken();

            if ( processAuthentication( userAgent, authToken, context ) )
            {
                return readyState;
            }
            else
            {
                return failedState;
            }
        }
        return null;
    }

}