test/java/rmi/transport/handshakeFailure/HandshakeFailure.java

Print this page

        

@@ -28,11 +28,12 @@
  * invalid JRMP protocol (such as because a non-JRMP server is currently
  * listening at that address), the client application should receive a
  * java.rmi.ConnectException or ConnectIOException, not a MarshalException.
  * @author Peter Jones
  *
- * @build HandshakeFailure
+ * @library ../../testlibrary
+ * @build HandshakeFailure TestLibrary
  * @run main/othervm HandshakeFailure
  */
 
 import java.net.ServerSocket;
 import java.net.Socket;

@@ -42,11 +43,11 @@
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 
 public class HandshakeFailure {
 
-    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 {
 
         /*