void send_impl () {

    assert Thread.holdsLock (this);

    if (request_object != null) {
      request_object.write (this);
      request_object = null;
    }
    if (index > request_index) {
      // Possibly pad request.
      int pad = pad (index - request_index);
      if (pad != 0)
        skip (pad);
      request_index = index;
      seq_number = (seq_number + 1) & 0xffff; // This counter is only 16-bit.
      if (index > (buffer.length - FLUSH_THRESHOLD)
          || send_mode == SendMode.SYNCHRONOUS) {
        flush ();
      }
    }
  }