diff --git a/network/tor/tor/src/main/java/bisq/tor/controller/ControlCommandFailedException.java b/network/tor/tor/src/main/java/bisq/tor/controller/ControlCommandFailedException.java index 67476d2fe3..18e0e435e6 100644 --- a/network/tor/tor/src/main/java/bisq/tor/controller/ControlCommandFailedException.java +++ b/network/tor/tor/src/main/java/bisq/tor/controller/ControlCommandFailedException.java @@ -18,6 +18,10 @@ package bisq.tor.controller; public class ControlCommandFailedException extends RuntimeException { + public ControlCommandFailedException(String message) { + super(message); + } + public ControlCommandFailedException(String message, Throwable cause) { super(message, cause); } diff --git a/network/tor/tor/src/main/java/bisq/tor/controller/WhonixTorController.java b/network/tor/tor/src/main/java/bisq/tor/controller/WhonixTorController.java index 4610c844c5..c3b4ccb939 100644 --- a/network/tor/tor/src/main/java/bisq/tor/controller/WhonixTorController.java +++ b/network/tor/tor/src/main/java/bisq/tor/controller/WhonixTorController.java @@ -52,6 +52,15 @@ public void addOnion(TorKeyPair torKeyPair, int onionPort, int localPort) throws String reply = receiveReply(); } + public void takeOwnership() throws IOException { + String command = "TAKEOWNERSHIP\r\n"; + sendCommand(command); + String reply = receiveReply(); + if (!reply.equals("250 OK")) { + throw new ControlCommandFailedException("Couldn't take ownership"); + } + } + private void sendCommand(String command) throws IOException { byte[] commandBytes = command.getBytes(StandardCharsets.US_ASCII); outputStream.write(commandBytes);