--- old/test/java/rmi/Naming/LookupIPv6.java 2014-01-24 14:23:46.858158161 +0800 +++ new/test/java/rmi/Naming/LookupIPv6.java 2014-01-24 14:23:44.926075004 +0800 @@ -25,7 +25,8 @@ * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing * IPv6 addresses. * @bug 4402708 - * + * @library ../testlibrary + * @build TestLibrary * @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6 */ @@ -37,6 +38,8 @@ import java.rmi.registry.Registry; public class LookupIPv6 { + private static final int REGISTRY_PORT = TestLibrary.getUnusedRandomPort(); + public static void main(String[] args) throws Exception { // use loopback IPv6 address to avoid lengthy socket connection delays String[] urls = { @@ -67,12 +70,12 @@ System.out.println("IPv6 detected"); Registry reg; try { - reg = LocateRegistry.createRegistry(Registry.REGISTRY_PORT); + reg = LocateRegistry.createRegistry(REGISTRY_PORT); } catch (Exception ex) { reg = LocateRegistry.getRegistry(); } reg.rebind("foo", reg); - Naming.lookup("rmi://[" + localAddr.getHostAddress() + "]/foo"); + Naming.lookup("rmi://[" + localAddr.getHostAddress() + "]" + ":" + REGISTRY_PORT + "/foo"); } } }