jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
changeset 42437 3224b6452c24
parent 30376 2ccf2cf7ea48
child 43503 bc7f8619ab70
equal deleted inserted replaced
42436:83d5d07ae03a 42437:3224b6452c24
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    41 import javax.management.remote.rmi.*;
    41 import javax.management.remote.rmi.*;
    42 
    42 
    43 public class RMIConnector_NPETest {
    43 public class RMIConnector_NPETest {
    44     public static void main(String argv[]) throws Exception {
    44     public static void main(String argv[]) throws Exception {
    45         RMID rmid = RMID.createRMID();
    45         RMID rmid = RMID.createRMID();
    46         rmid.start();
       
    47         int rmidPort = rmid.getPort();
       
    48         Exception failureCause = null;
    46         Exception failureCause = null;
    49         RMIConnector agent = null;
    47         RMIConnector agent = null;
    50 
    48 
    51         try {
    49         try {
       
    50             rmid.start();
       
    51             int rmidPort = rmid.getPort();
    52             MBeanServer mbs = MBeanServerFactory.createMBeanServer();
    52             MBeanServer mbs = MBeanServerFactory.createMBeanServer();
    53             RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(rmidPort, null, null, null);
    53             RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(rmidPort, null, null, null);
    54             rmiserver.setMBeanServer(mbs);
    54             rmiserver.setMBeanServer(mbs);
    55             agent = new RMIConnector(rmiserver, null);
    55             agent = new RMIConnector(rmiserver, null);
    56             agent.connect();
    56             agent.connect();
    73             TestLibrary.bomb("Test failed", failureCause);
    73             TestLibrary.bomb("Test failed", failureCause);
    74         }
    74         }
    75 
    75 
    76     }
    76     }
    77 }
    77 }
       
    78