jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java
changeset 13256 5886d7607acd
parent 5506 202f599c92aa
child 14778 5947768d173d
--- a/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java	Mon Jul 16 22:05:16 2012 -0700
+++ b/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java	Tue Jul 17 11:01:44 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @build Ping
  * @build UseCustomRef_Stub
  * @build UseCustomRef_Skel
+ * @build TestLibrary
  * @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef
  *
  * This test was failing to run because the synthetic access
@@ -84,8 +85,9 @@
             TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 
             System.err.println("creating Registry...");
-            registry = LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
 
+            registry = TestLibrary.createRegistryOnUnusedPort();
+            int port = TestLibrary.getRegistryPort(registry);
             /*
              * create object with custom ref and bind in registry
              */
@@ -97,7 +99,7 @@
                                 "instanceof CustomServerRef");
             }
 
-            String name = "//:" + TestLibrary.REGISTRY_PORT + "/UseCustomRef";
+            String name = "//:" + port + "/UseCustomRef";
             //      String name = "UseCustomRef";
             System.err.println("binding object in registry...");
             Naming.rebind(name, cr);