test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java

Print this page

        

@@ -88,21 +88,21 @@
 
         System.err.println("TEST PASSED");
     }
 
     public static class DoRMIStuff {
-        private static final int PORT = 2020;
         private interface Foo extends Remote {
             Object echo(Object obj) throws RemoteException;
         }
         private static class FooImpl implements Foo {
             FooImpl() { }
             public Object echo(Object obj) { return obj; }
         }
         public static void main(String[] args) throws Exception {
-            LocateRegistry.createRegistry(PORT);
-            Registry reg = LocateRegistry.getRegistry("", PORT);
+            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            int registryPort = TestLibrary.getRegistryPort(registry);
+            Registry reg = LocateRegistry.getRegistry("", registryPort);
             FooImpl fooimpl = new FooImpl();
             UnicastRemoteObject.exportObject(fooimpl, 0);
             reg.rebind("foo", fooimpl);
             Foo foostub = (Foo) reg.lookup("foo");
             FooImpl fooimpl2 = new FooImpl();