ioHandlers.put(new Integer(clientId), testIoHandler); ConnectFuture future = connector.connect(address, testIoHandler); future.join(); Assert.assertTrue("connection to server failed", future.isConnected());
synchronized (ioHandlers) { ioHandlers.put(new Integer(clientId), testIoHandler); System.out.println("@@@@@@ registered Handler "+clientId + ", " + testIoHandler + ", " + Thread.currentThread()); ConnectFuture future = connector.connect(address, testIoHandler); future.join(); Assert.assertTrue("connection to server failed", future.isConnected()); }
    public void connect(int clientId, TransportType transportType, int port)            throws UnknownHostException, IOException {        IoConnector connector;        SocketAddress address;        if (transportType == TransportType.SOCKET) {            connector = new SocketConnector();            address = new InetSocketAddress("localhost", port);        } else if (transportType == TransportType.VM_PIPE) {            connector = new VmPipeConnector();            address = new VmPipeAddress(port);        } else {            throw new RuntimeException("Unsupported transport type: " + transportType);        }        TestIoHandler testIoHandler = new TestIoHandler();        ioHandlers.put(new Integer(clientId), testIoHandler);        ConnectFuture future = connector.connect(address, testIoHandler);        future.join();        Assert.assertTrue("connection to server failed", future.isConnected());    }