protected function initializeStream(DuplexStreamInterface $stream, ConnectionInterface $connection)
    {
        try {
            $connection->setData('stream', $stream);
            $write = $this->getWriteStream($connection);
            $connection->setData('write', $write);
            $this->configureStreams($connection, $stream, $write);
            $this->identifyUser($connection, $write);
        } catch (\Exception $e) {
            $this->emitConnectionError($e, $connection);
        }
    }