--- old/test/java/rmi/transport/httpSocket/HttpSocketTest.java	2012-04-20 14:47:17.612555315 -0700
+++ new/test/java/rmi/transport/httpSocket/HttpSocketTest.java	2012-04-20 14:47:17.225056444 -0700
@@ -27,7 +27,7 @@
  * @author Dana Burns
  *
  * @library ../../testlibrary
- * @build HttpSocketTest HttpSocketTest_Stub
+ * @build HttpSocketTest HttpSocketTest_Stub TestLibrary
  * @run main/othervm/policy=security.policy HttpSocketTest
  */
 
@@ -56,10 +56,7 @@
 public class HttpSocketTest extends UnicastRemoteObject
     implements MyRemoteInterface
 {
-
     private static final String NAME = "HttpSocketTest";
-    private static final String REGNAME =
-        "//:" + TestLibrary.REGISTRY_PORT + "/" + NAME;
 
     public HttpSocketTest() throws RemoteException{}
 
@@ -76,12 +73,14 @@
         // Set the socket factory.
         System.err.println("installing socket factory");
         RMISocketFactory.setSocketFactory(new RMIHttpToPortSocketFactory());
+        int registryPort = -1;
 
         try {
 
             System.err.println("Starting registry");
-            registry = LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
-
+            TestLibrary.getUnusedRandomPort();
+            registry = TestLibrary.createRegistryOnUnusedPort();
+            registryPort = TestLibrary.getRegistryPort(registry);
         } catch (Exception e) {
             TestLibrary.bomb(e);
         }
@@ -90,7 +89,7 @@
 
             registry.rebind( NAME, new HttpSocketTest() );
             MyRemoteInterface httpTest =
-                (MyRemoteInterface)Naming.lookup( REGNAME );
+                (MyRemoteInterface)Naming.lookup("//:" + registryPort + "/" + NAME);
             httpTest.setRemoteObject( new HttpSocketTest() );
             Remote r = httpTest.getRemoteObject();