test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -29,10 +29,12 @@
  * particular, after the stub has become unreachable and all
  * connections to its endpoint have been closed, then the factory
  * should become unreachable too (through the RMI implementation).
  * @author Peter Jones
  *
+ * @library ../../testlibrary
+ * @build TestLibrary
  * @run main/othervm -Dsun.rmi.transport.connectionTimeout=2000
  *     PinClientSocketFactory
  */
 
 import java.io.IOException;

@@ -54,11 +56,11 @@
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class PinClientSocketFactory {
 
-    private static final int PORT = 2345;
+    private static final int PORT = TestLibrary.getUnusedRandomPort();
     private static final int SESSIONS = 50;
 
     public interface Factory extends Remote {
         Session getSession() throws RemoteException;
     }