/// <summary>
        /// Starts connection
        /// </summary>
        public void Open()
        {
            if (ConnectionInfo.Address == null || ConnectionInfo.Port <= 0)
            {
                throw new InvalidOperationException(Resources.AddressAndPortException);
            }

            _messageFactory.Username = ConnectionInfo.Username;
            _connection = new IrcConnection(new IPEndPoint(ConnectionInfo.Address, ConnectionInfo.Port));
            _connection.StateChanged += OnStateChanged;
            _connection.MessageReceived += OnMessageReceived;
            _connection.MessageSent += OnMessageSent;
            _connection.OpenAsync();
            StartConnection();
        }
 /// <summary>
 /// Creates instance
 /// </summary>
 /// <param name="size">Defines the size of the buffer</param>
 /// <param name="connection">IrcConnection used to read message</param>
 public IrcConnectionReceiveBuffer(Int32 size, IrcConnection connection)
 {
     _buffer = new Byte[size];
     _connection = connection;
 }