diff --git a/src/javarepl/Main.java b/src/javarepl/Main.java index 1359502..2b4d32d 100644 --- a/src/javarepl/Main.java +++ b/src/javarepl/Main.java @@ -111,10 +111,10 @@ private static String welcomeInstructions() { private static JavaREPLClient clientFor(Option hostname, Option port) throws Exception { console.printInfo(welcomeMessage()); - if (hostname.isEmpty() && port.isEmpty()) { - return startNewLocalInstance("localhost", randomServerPort()); + if (hostname.isDefined() && port.isDefined()) { + return connectToRemoteInstance(hostname.get(), port.getOrElse(randomServerPort())); } else { - return connectToRemoteInstance(hostname.getOrElse("localhost"), port.getOrElse(randomServerPort())); + return startNewLocalInstance("localhost", port.getOrElse(randomServerPort())); } }