/* * 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); }