private void FlushBufferedWriter() { var bufferedWriter = _writeBuffer; if (bufferedWriter == _outputWriter) { return; } _writeBuffer = _outputWriter; using (bufferedWriter) { _writeBuffer.Write((int)bufferedWriter.Length); bufferedWriter.WriteTo(_writeBuffer); } }
public void SetMethod(string method) { if (string.IsNullOrEmpty(method)) { throw new ArgumentNullException("method"); } if (_messageType != MessageType.Request) { throw new InvalidOperationException("Method is only allow in request messages."); } _writeBuffer.Write(method); }