/**
  * Configures an established stream for a given connection.
  *
  * This method is only public to allow it to be called from
  * addSecureConnection() under PHP 5.3.x. It should not be called outside
  * this class.
  *
  * @param \React\Stream\StreamInterface $stream
  * @param \Phergie\Irc\ConnectionInterface $connection
  */
 public function initializeStream(StreamInterface $stream, ConnectionInterface $connection)
 {
     try {
         $connection->setOption('stream', $stream);
         $write = $this->getWriteStream($connection);
         $connection->setOption('write', $write);
         $this->configureStreams($connection, $stream, $write);
         $this->identifyUser($connection, $write);
     } catch (\Exception $e) {
         $this->emitConnectionError($e, $connection);
     }
 }