test/java/rmi/transport/handshakeFailure/HandshakeFailure.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.

@@ -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 {
 
         /*