private void ReadLoop()
        {
            if (!Reading)
            {
                return;
            }

            var buffer = new byte[1024];

            _stream.ReadAsync(buffer).ContinueWith(task =>
            {
                if (task.Exception != null)
                {
                    var exception = task.Exception.GetBaseException();

                    if (!HttpBasedTransport.IsRequestAborted(exception))
                    {
                        if (!(exception is IOException))
                        {
                            _connection.OnError(exception);
                        }
                        StopReading(true);
                    }
                    return;
                }

                var read = task.Result;

                // Put chunks in the buffer
                if (read > 0)
                {
                    _buffer.Add(buffer, read);
                }

                // Stop any reading we're doing
                if (read == 0)
                {
                    StopReading(true);
                    return;
                }

                // Keep reading the next set of data
                ReadLoop();

                // If we read less than we wanted or if we filled the buffer, process it
                if (read <= buffer.Length)
                {
                    ProcessBuffer();
                }
            });
        }