Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
SocketServerInvoker serverInvoker = (SocketServerInvoker) callbackConnector.getServerInvoker();
Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
field.setAccessible(true);
LRUPool clientpool = (LRUPool) field.get(serverInvoker);
// Verify MicroSocketClientInvoker retries invocation after failure to get a connection.
client.invoke(SEND_CALLBACK);
assertEquals(1, callbackHandler.received);
Set serverThreads = clientpool.getContents();
Iterator it = serverThreads.iterator();
while (it.hasNext())
{
ServerThread st = (ServerThread) it.next();
st.shutdown();
}
client.invoke(SEND_CALLBACK);
assertEquals(2, callbackHandler.received);
serverThreads = clientpool.getContents();
it = serverThreads.iterator();
while (it.hasNext())
{
ServerThread st = (ServerThread) it.next();
st.shutdown();