public void testTwoClientsTwoConnectorsOneHandler() throws Throwable
{
log.info("entering " + getName());
String host = InetAddress.getLocalHost().getHostName();
String locatorURI = getTransport() + "://" + host + ":" + port;
InvokerLocator serverLocator = new InvokerLocator(locatorURI);
log.info("Connecting to: " + serverLocator);
HashMap config = new HashMap();
config.put(InvokerLocator.FORCE_REMOTE, "true");
addExtraClientConfig(config);
Client client1 = new Client(serverLocator, config);
client1.connect();
Client client2 = new Client(serverLocator, config);
client2.connect();
log.info("clients are connected");
assertTrue(client1.getInvoker() instanceof BisocketClientInvoker);
assertTrue(client2.getInvoker() instanceof BisocketClientInvoker);
String callbackLocatorURI1 = getTransport() + "://" + host + ":1";
config.put(Bisocket.IS_CALLBACK_SERVER, "true");
Connector callbackConnector1 = new Connector(callbackLocatorURI1, config);
callbackConnector1.start();
String callbackLocatorURI2 = getTransport() + "://" + host + ":2";
Connector callbackConnector2 = new Connector(callbackLocatorURI2, config);
callbackConnector2.start();
DelayedCallbackHandler callbackHandler = new DelayedCallbackHandler();
client1.addListener(callbackHandler, new InvokerLocator(callbackLocatorURI1));
client2.addListener(callbackHandler, new InvokerLocator(callbackLocatorURI2));
assertEquals(2, invocationHandler.callbackHandlers.size());
log.info("clients added callback handler");
Iterator it = invocationHandler.callbackHandlers.iterator();
ServerInvokerCallbackHandler serverInvokerCallbackHandler1 = (ServerInvokerCallbackHandler) it.next();