< prev index next >

test/java/rmi/transport/closeServerSocket/CloseServerSocket.java

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4457683
  26  * @summary After all of the remote objects (including a registry, if
  27  * applicable) that had been exported with a given
  28  * RMIServerSocketFactory value (including null) have been unexported,
  29  * the server socket created for the exports should be closed (so that
  30  * the local port is released).
  31  * @author Peter Jones
  32  *
  33  * @library ../../testlibrary




  34  * @build TestLibrary
  35  * @run main/othervm CloseServerSocket
  36  */
  37 
  38 import java.io.IOException;
  39 import java.net.BindException;
  40 import java.net.ServerSocket;
  41 import java.rmi.Remote;
  42 import java.rmi.registry.LocateRegistry;
  43 import java.rmi.registry.Registry;
  44 import java.rmi.server.RMIServerSocketFactory;
  45 import java.rmi.server.UnicastRemoteObject;
  46 
  47 public class CloseServerSocket implements Remote {
  48     private static final int PORT = TestLibrary.getUnusedRandomPort();
  49 
  50     private CloseServerSocket() { }
  51 
  52     public static void main(String[] args) throws Exception {
  53         System.err.println("\nRegression test for bug 4457683\n");




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4457683
  26  * @summary After all of the remote objects (including a registry, if
  27  * applicable) that had been exported with a given
  28  * RMIServerSocketFactory value (including null) have been unexported,
  29  * the server socket created for the exports should be closed (so that
  30  * the local port is released).
  31  * @author Peter Jones
  32  *
  33  * @library ../../testlibrary
  34  * @modules java.rmi/sun.rmi.registry
  35  *          java.rmi/sun.rmi.server
  36  *          java.rmi/sun.rmi.transport
  37  *          java.rmi/sun.rmi.transport.tcp
  38  * @build TestLibrary
  39  * @run main/othervm CloseServerSocket
  40  */
  41 
  42 import java.io.IOException;
  43 import java.net.BindException;
  44 import java.net.ServerSocket;
  45 import java.rmi.Remote;
  46 import java.rmi.registry.LocateRegistry;
  47 import java.rmi.registry.Registry;
  48 import java.rmi.server.RMIServerSocketFactory;
  49 import java.rmi.server.UnicastRemoteObject;
  50 
  51 public class CloseServerSocket implements Remote {
  52     private static final int PORT = TestLibrary.getUnusedRandomPort();
  53 
  54     private CloseServerSocket() { }
  55 
  56     public static void main(String[] args) throws Exception {
  57         System.err.println("\nRegression test for bug 4457683\n");


< prev index next >