// indicating the target remoting server to call upon.
InvokerLocator locator = new InvokerLocator(locatorURI);
client = new Client(locator);
client.connect();
SocketClientInvoker invoker = (SocketClientInvoker) client.getInvoker();
// No sockets are in use.
// assertEquals(0, invoker.usedPooled);
// log.info("usedPool: " + invoker.usedPooled);
assertEquals(0, invoker.getNumberOfUsedConnections());
// Make SocketPoolTestServer.NUMBER_OF_CALLS invocations.
for (int i = 0; i < SocketPoolTestServer.NUMBER_OF_CALLS; i++)
{
new Invoker(client, i).start();
}
Thread.sleep(500);
// SocketPoolTestServer.NUMBER_OF_CALLS sockets are in use.
// log.info("usedPool: " + invoker.usedPooled);
// assertEquals(SocketPoolTestServer.NUMBER_OF_CALLS, invoker.usedPooled);
log.info("usedPool: " + invoker.getNumberOfUsedConnections());
assertEquals(SocketPoolTestServer.NUMBER_OF_CALLS, invoker.getNumberOfUsedConnections());
Thread.sleep(5000);
// All invocations have timed out. All sockets should be closed and discarded.
// log.info("usedPool: " + invoker.usedPooled);
// assertEquals(0, invoker.usedPooled);
log.info("usedPool: " + invoker.getNumberOfUsedConnections());
assertEquals(0, invoker.getNumberOfUsedConnections());
}
finally
{
if(client != null)
{