// Wait for there to be two ServerThreads in the master
// MultiplexServerInvoker's clientpool.
field = SocketServerInvoker.class.getDeclaredField("clientpool");
field.setAccessible(true);
LRUPool clientpool = (LRUPool) field.get(connector.getServerInvoker());
for (int i = 0; i < 5; i++)
{
if (clientpool.size() == 2)
break;
Thread.sleep(1000);
}
if (clientpool.size() != 2)
fail();
// Wait for the two virtual MultiplexServerInvokers to shut down.
client1.disconnect();
client2.disconnect();
for (int i = 0; i < 5; i++)
{
if (virtualServerInvokers.size() == 0)
break;
Thread.sleep(1000);
}
assertTrue(virtualServerInvokers.size() == 0);
// Verify that the master MultiplexServerInvoker still has two ServerThreads.
field = SocketServerInvoker.class.getDeclaredField("threadpool");
field.setAccessible(true);
LinkedList threadpool = (LinkedList) field.get(connector.getServerInvoker());
assertTrue(clientpool.size() + threadpool.size() == 2);
log.info(getName() + " PASSES");
OKCounter++;
}
catch (Throwable t)