static void killPortAndWait(int port) { killPortAndWait("localhost", port); } static void killPortAndWait(S ip, int port) ctex { print("Sending kill switch to " + ip + ":" + port); DialogIO io = talkTo(ip, port); io.sendLine("kill!"); try { // wait until it is closed from other side S s; while ((s = io.readLine()) != null) print(port + "< " + s); } catch (Exception e) {} io.close(); // never throws exceptions }