String host = argv[0];
String name = argv[1];
ThisOrThatServer server = null;
try {
Registry rmtRegistry = LocateRegistry.getRegistry(host);
server = (ThisOrThatServer)rmtRegistry.lookup(name);
System.out.println(server.doThis("thing"));
System.out.println(server.doThat("thing"));
}
catch (Exception e) {
e.printStackTrace();
System.out.println("Failed to connect to server.");
System.out.println("Let's try again, just for laughs");
try {
System.out.println(server.doThis("thing"));
System.out.println(server.doThat("thing"));
}
catch (Exception e2) {
System.out.println("Nope.");
}
}