private void flushCurrentOutputCell() {
    if (currentOutputCell != null
        && currentOutputCell.cellBytesConsumed() > RelayCell.HEADER_SIZE) {
      stream.waitForSendWindowAndDecrement();
      stream.getCircuit().sendRelayCell(currentOutputCell);
      bytesSent += (currentOutputCell.cellBytesConsumed() - RelayCell.HEADER_SIZE);
    }

    currentOutputCell =
        new RelayCellImpl(
            stream.getTargetNode(),
            stream.getCircuit().getCircuitId(),
            stream.getStreamId(),
            RelayCell.RELAY_DATA);
  }