Beispiel #1
0
  /*
   * Start listening with the specified Connector and check that the
   * returned address includes a host component. If 'addr' is not null
   * then set the localAddress argument to be the address.
   */
  private static void check(ListeningConnector connector, InetAddress addr)
      throws IOException, IllegalConnectorArgumentsException {
    Map args = connector.defaultArguments();
    if (addr != null) {
      Connector.StringArgument addr_arg = (Connector.StringArgument) args.get("localAddress");
      addr_arg.setValue(addr.getHostAddress());
    }

    String address = connector.startListening(args);
    if (address.indexOf(':') < 0) {
      System.out.println(address + " => Failed - no host component!");
      failures++;
    } else {
      System.out.println(address);
    }
    connector.stopListening(args);
  }
Beispiel #2
0
 /* listen for connection from target vm */
 private VirtualMachine listenTarget() {
   ListeningConnector listener = (ListeningConnector) connector;
   try {
     String retAddress = listener.startListening(connectorArgs);
     MessageOutput.println("Listening at address:", retAddress);
     vm = listener.accept(connectorArgs);
     listener.stopListening(connectorArgs);
     return vm;
   } catch (IOException ioe) {
     ioe.printStackTrace();
     MessageOutput.fatalError("Unable to attach to target VM.");
   } catch (IllegalConnectorArgumentsException icae) {
     icae.printStackTrace();
     MessageOutput.fatalError("Internal debugger error.");
   }
   return null; // Shuts up the compiler
 }