public RelayCell receiveRelayResponse(int expectedCommand, Router extendTarget) {
   final RelayCell cell = circuit.receiveRelayCell();
   if (cell == null) {
     throw new TorException("Timeout building circuit");
   }
   final int command = cell.getRelayCommand();
   if (command == RelayCell.RELAY_TRUNCATED) {
     final int code = cell.getByte() & 0xFF;
     final String msg = CellImpl.errorToDescription(code);
     final String source = nodeToName(cell.getCircuitNode());
     if (code == Cell.ERROR_PROTOCOL) {
       logProtocolViolation(source, extendTarget);
     }
     throw new TorException(
         "Error from ("
             + source
             + ") while extending to ("
             + extendTarget.getNickname()
             + "): "
             + msg);
   } else if (command != expectedCommand) {
     final String expected = RelayCellImpl.commandToDescription(expectedCommand);
     final String received = RelayCellImpl.commandToDescription(command);
     throw new TorException(
         "Received incorrect extend response, expecting "
             + expected
             + " but received "
             + received);
   } else {
     return cell;
   }
 }
 private void sendCreateFastCell(TorCreateFastKeyAgreement kex) {
   final Cell cell = CellImpl.createCell(circuit.getCircuitId(), Cell.CREATE_FAST);
   cell.putByteArray(kex.createOnionSkin());
   circuit.sendCell(cell);
 }