test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java

Print this page

        

@@ -31,11 +31,12 @@
  * java.rmi.ConnectException or ConnectIOException, not a MarshalException,
  * because it should be clear that no partial call execution has occurred at
  * this point (because no data for the invocation has yet been written).
  * @author Peter Jones
  *
- * @build HandshakeTimeout
+ * @library ../../testlibrary
+ * @build HandshakeTimeout TestLibrary
  * @run main/othervm HandshakeTimeout
  */
 
 import java.net.ServerSocket;
 import java.rmi.ConnectException;

@@ -44,11 +45,11 @@
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 
 public class HandshakeTimeout {
 
-    private static final int PORT = 2020;
+    private static final int PORT = TestLibrary.getUnusedRandomPort();
     private static final int TIMEOUT = 10000;
 
     public static void main(String[] args) throws Exception {
 
         System.setProperty("sun.rmi.transport.tcp.handshakeTimeout",