protected function getProcessCallback()
    {
        return function ($state, $response) {
            list($command, $callback) = $this->commands->dequeue();

            switch ($command->getId()) {
                case 'SUBSCRIBE':
                case 'PSUBSCRIBE':
                    $wrapper = $this->getStreamingWrapperCreator();
                    $callback = $wrapper($this, $callback);
                    $state->setStreamingContext(State::PUBSUB, $callback);
                    break;

                case 'MONITOR':
                    $wrapper = $this->getStreamingWrapperCreator();
                    $callback = $wrapper($this, $callback);
                    $state->setStreamingContext(State::MONITOR, $callback);
                    break;

                case 'MULTI':
                    $state->setState(State::MULTIEXEC);
                    goto process;

                case 'EXEC':
                case 'DISCARD':
                    $state->setState(State::CONNECTED);
                    goto process;

                default:
                process:
                    \call_user_func($callback, $response, $this, $command);
                    break;
            }
        };
    }