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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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.

@@ -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",