JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
Client client = remotingConnection.getRemotingClient();
Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
field.setAccessible(true);
InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
String transport = locator.getProtocol();
if ("socket".equals(transport)
|| "sslsocket".equals(transport)
|| "bisocket".equals(transport)
|| "sslbisocket".equals(transport))
{
field = Client.class.getDeclaredField("callbackConnectors");
field.setAccessible(true);
Map callbackConnectors = (Map)field.get(client);
InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
Connector connector = (Connector)callbackConnectors.get(callbackHandler);
locator = new InvokerLocator(connector.getInvokerLocator());
assertEquals(address, locator.getHost());
assertEquals(freePort, locator.getPort());
}
else if ("http".equals(transport))
{
field = Client.class.getDeclaredField("callbackPollers");
field.setAccessible(true);