// Give the client a chance to connect to the server, then
// disable the server.
Thread.sleep(2000);
ServerInvoker si = connector.getServerInvoker();
assertTrue(si instanceof SocketServerInvoker);
SocketServerInvoker ssi = (SocketServerInvoker) si;
Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
field.setAccessible(true);
LRUPool clientpool = (LRUPool) field.get(ssi);
Set threads = clientpool.getContents();
Iterator it = threads.iterator();
while (it.hasNext())
{
ServerThread t = (ServerThread) it.next();
t.shutdown();
}
ssi.setMaxPoolSize(0);
log.info("server is disabled");
}
catch (Exception e)
{
log.info(e);