anchor.diff:   * standard input and standard output) to communicate with clients.
    */
   class ByteStreamServerChannel implements ServerCommunicationChannel {
  +  /**
  +   * Value of [_outputState] indicating that there is no outstanding data in
  +   * [_pendingOutput], and that the most recent flush of [_output] has
  +   * completed.
  +   */
  +  static const int _STATE_IDLE = 0;
  +
  +  /**
  +   * Value of [_outputState] indicating that there is outstanding data in
  +   * [_pendingOutput], and that the most recent flush of [_output] has
  +   * completed; therefore a microtask has been scheduled to send the data.
  +   */
  +  static const int _STATE_MICROTASK_PENDING = 1;
  +
  +  /**
  +   * Value of [_outputState] indicating that data has been sent to the
  +   * [_output] stream and flushed, but the flush has not completed, so we must
  +   * wait for it to complete before sending more data.  There may or may not be
  +   * outstanding data in [_pendingOutput].
  +   */
  +  static const int _STATE_FLUSH_PENDING = 2;
  +
     final Stream input;
  -  final IOSink output;
  +
  +  final IOSink _output;
   
     /**
      * Completer that will be signalled when the input stream is closed.
      */
     final Completer _closed = new Completer();
   
  -  ByteStreamServerChannel(this.input, this.output);
  +  /**
  +   * State of the output stream (see constants above).
  +   */
  +  int _outputState = _STATE_IDLE;
  +
  +  /**
  +   * List of strings that need to be sent to [_output] at the next available
  +   * opportunity.
  +   */
  +  List<String> _pendingOutput = <String>[];
  +
  +  /**
  +   * True if [close] has been called.
  +   */
  +  bool _closeRequested = false;
  +
  +  ByteStreamServerChannel(this.input, this._output);
   
     /**
      * Future that will be completed when the input stream is closed.
  
positive.code:   void sendNotification(Notification notification) {
      // Don't send any further notifications after the communication channel is
      // closed.
      if (_closed.isCompleted) {
        return;
      }
      ServerCommunicationChannel.ToJson.start();
      String jsonEncoding = JSON.encode(notification.toJson());
      ServerCommunicationChannel.ToJson.stop();
      output.write(jsonEncoding + '\n');
    }
  
    @override
    void sendResponse(Response response) {
      // Don't send any further responses after the communication channel is
      // closed.
      if (_closed.isCompleted) {
        return;
      }
      ServerCommunicationChannel.ToJson.start();
      String jsonEncoding = JSON.encode(response.toJson());
      ServerCommunicationChannel.ToJson.stop();
      output.write(jsonEncoding + '\n');
    }
  
    /**
  
negative.code: 
    @override
    void close() {
      if (!_closeRequested) {
        _closeRequested = true;
        if (_outputState == _STATE_IDLE) {
          assert(!_closed.isCompleted);
          _closed.complete();
        } else {
          // Nothing to do.  [_flushCompleted] will call _closed.complete() after
          // the flush completes.
        }
      }
    }
  
    @override
  