public void backslash_removes_previous_char(string textWithBackslashes, string textWithoutBackslashes)
        {
            var textBytesWithoutBacklashes = Encoding.ASCII.GetBytes(textWithoutBackslashes);
            var textBytesWithBackslashes   = Encoding.ASCII.GetBytes(textWithBackslashes);

            Assert.Equal(textBytesWithoutBacklashes, StringReaderStream.ProcessBackslashes(textBytesWithBackslashes));
        }
        public async Task ProcessCommandsAsync()
        {
            var cancellationToken = _cts.Token;

            try
            {
                while (!_cts.IsCancellationRequested)
                {
                    byte[] line;
                    try
                    {
                        line = await _readLineSource.ReadLineAsync(cancellationToken);

                        if (line == null)
                        {
                            RequestDisconnection(this, RequestDisconnectionEventArgs.Expected);
                            return;
                        }
                    }
                    catch (IOException)
                    {
                        RequestDisconnection(this, RequestDisconnectionEventArgs.Unexpected);
                        return;
                    }
                    catch (TaskCanceledException)
                    {
                        return;
                    }
                    catch (ObjectDisposedException)
                    {
                        return;
                    }

                    DetectedActivity(this, EventArgs.Empty);

                    line = StringReaderStream.ProcessBackslashes(line);

                    ProcessLineCommand(this, new BufferEventArgs(line));
                }
            }
            catch (Exception ex)
            {
                MailServerLogger.Instance.Error(ex);
                RequestDisconnection(this, RequestDisconnectionEventArgs.Unexpected);
            }
            finally
            {
                _cts = new CancellationTokenSource();
            }
        }