--- old/test/java/rmi/registry/interfaceHash/InterfaceHash.java 2016-12-02 00:11:15.072109697 -0800 +++ new/test/java/rmi/registry/interfaceHash/InterfaceHash.java 2016-12-02 00:11:14.908027692 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, 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 @@ -63,7 +63,6 @@ public class InterfaceHash { - private static final int PORT = TestLibrary.getUnusedRandomPort(); private static final String NAME = "WMM"; public static void main(String[] args) throws Exception { @@ -73,12 +72,13 @@ "\n=== verifying that J2SE registry's skeleton uses" + "\ncorrect interface hash and operation numbers:"); - Registry testImpl = LocateRegistry.createRegistry(PORT); - System.err.println("created test registry on port " + PORT); + Registry testImpl = TestLibrary.createRegistryOnEphemeralPort(); + int regPort = TestLibrary.getRegistryPort(testImpl); + System.err.println("created test registry on port " + regPort); RemoteRef ref = new UnicastRef( new LiveRef(new ObjID(ObjID.REGISTRY_ID), - new TCPEndpoint("", PORT), false)); + new TCPEndpoint("", regPort), false)); Registry referenceStub = new ReferenceRegistryStub(ref); System.err.println("created reference registry stub: " + referenceStub); @@ -144,7 +144,7 @@ } FakeRemoteRef f = new FakeRemoteRef(); - Registry testRegistry = LocateRegistry.getRegistry(PORT); + Registry testRegistry = LocateRegistry.getRegistry(regPort); System.err.println("created original test registry stub: " + testRegistry);