public function process($response)
    {
        if ($this->checkFlags(self::CONNECTED)) {
            return call_user_func($this->processCallback, $this, $response);
        }

        if ($this->checkFlags(self::STREAM_CONTEXT)) {
            return call_user_func($this->streamCallback, $this, $response);
        }

        // TODO: we should handle invalid states in a different manner.
        throw new RuntimeException("Invalid connection state: $this");
    }