field.setAccessible(true);
SocketGroupInfo sgi = (SocketGroupInfo) field.get(clientInvoker);
VirtualSocket socket = sgi.getPrimingSocket();
field = VirtualSocket.class.getDeclaredField("manager");
field.setAccessible(true);
MultiplexingManager clientManager = (MultiplexingManager) field.get(socket);
assertNotNull(clientManager);
// Get server invoker's MultiplexingManager.
field = Client.class.getDeclaredField("callbackConnectors");
field.setAccessible(true);
Map callbackConnectors = (Map) field.get(client);
assertEquals(1, callbackConnectors.size());
Set callbackConnectorSet = (Set) callbackConnectors.values().iterator().next();
assertEquals(1, callbackConnectorSet.size());
Connector connector = (Connector) callbackConnectorSet.iterator().next();
MultiplexServerInvoker serverInvoker = (MultiplexServerInvoker) connector.getServerInvoker();
field = SocketServerInvoker.class.getDeclaredField("serverSocket");
field.setAccessible(true);
VirtualServerSocket serverSocket = (VirtualServerSocket) field.get(serverInvoker);
field = VirtualServerSocket.class.getDeclaredField("manager");
field.setAccessible(true);
MultiplexingManager serverManager = (MultiplexingManager) field.get(serverSocket);
// Show client and server invokers are using the same MultiplexingManager.
assertEquals(clientManager, serverManager);
client.removeListener(testCallbackHandler);