Java Code Examples for com.sun.jdi.connect.Connector#IntegerArgument
The following examples show how to use
com.sun.jdi.connect.Connector#IntegerArgument .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AcceptTimeout.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 2
Source File: AcceptTimeout.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 3
Source File: AcceptTimeout.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 4
Source File: AcceptTimeout.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 5
Source File: AcceptTimeout.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 6
Source File: AcceptTimeout.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 7
Source File: AcceptTimeout.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example 8
Source File: ExclusiveBind.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee Process process1 = launch(address, true, "HelloWorld"); // give first debuggee time to suspend Thread.currentThread().sleep(5000); // launch a second debuggee with the same address Process process2 = launch(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = process2.waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 9
Source File: ExclusiveBind.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 10
Source File: ExclusiveBind.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 11
Source File: RunToExit.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }
Example 12
Source File: RunToExit.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }
Example 13
Source File: ExclusiveBind.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 14
Source File: ExclusiveBind.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 15
Source File: RunToExit.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }
Example 16
Source File: ExclusiveBind.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 17
Source File: RunToExit.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }
Example 18
Source File: ExclusiveBind.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the first debuggee ProcessBuilder process1 = prepareLauncher(address, true, "HelloWorld"); // start the debuggee and wait for the "ready" message Process p = ProcessTools.startProcess( "process1", process1, line -> line.equals("Listening for transport dt_socket at address: " + address), Math.round(5000 * Utils.TIMEOUT_FACTOR), TimeUnit.MILLISECONDS ); // launch a second debuggee with the same address ProcessBuilder process2 = prepareLauncher(address, false, "HelloWorld"); // get exit status from second debuggee int exitCode = ProcessTools.startProcess("process2", process2).waitFor(); // clean-up - attach to first debuggee and resume it AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); vm.resume(); // if the second debuggee ran to completion then we've got a problem if (exitCode == 0) { throw new RuntimeException("Test failed - second debuggee didn't fail to bind"); } else { System.out.println("Test passed - second debuggee correctly failed to bind"); } }
Example 19
Source File: RunToExit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }
Example 20
Source File: RunToExit.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String args[]) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); String address = String.valueOf(port); // launch the server debuggee Process process = launch(address, "Exit0"); // wait for the debugge to be ready while (!ready) { try { Thread.sleep(1000); } catch(Exception ee) { throw ee; } } // attach to server debuggee and resume it so it can exit AttachingConnector conn = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map conn_args = conn.defaultArguments(); Connector.IntegerArgument port_arg = (Connector.IntegerArgument)conn_args.get("port"); port_arg.setValue(port); VirtualMachine vm = conn.attach(conn_args); // The first event is always a VMStartEvent, and it is always in // an EventSet by itself. Wait for it. EventSet evtSet = vm.eventQueue().remove(); for (Event event: evtSet) { if (event instanceof VMStartEvent) { break; } throw new RuntimeException("Test failed - debuggee did not start properly"); } vm.eventRequestManager().deleteAllBreakpoints(); vm.resume(); int exitCode = process.waitFor(); // if the server debuggee ran cleanly, we assume we were clean if (exitCode == 0 && error_seen == 0) { System.out.println("Test passed - server debuggee cleanly terminated"); } else { throw new RuntimeException("Test failed - server debuggee generated an error when it terminated"); } }