test/java/rmi/server/useCustomRef/UseCustomRef.java
Print this page
@@ -33,10 +33,11 @@
* @library ../../testlibrary
* @build UseCustomRef
* @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
* control context used by the application class loader to find and define
* CustomServerRef does not have accessClassInPackage.sun.rmi.server runtime
@@ -82,12 +83,13 @@
* create registry
*/
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
*/
System.err.println("creating UseCustomRef...");
UseCustomRef cr = new UseCustomRef();
@@ -95,11 +97,11 @@
if (!(ref instanceof CustomServerRef)) {
TestLibrary.bomb("test failed: reference not " +
"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);
/*