assertTrue(enumeration.hasMore());
Binding binding = (Binding) enumeration.next();
assertFalse(enumeration.hasMore());
log.info(binding);
assertTrue(binding.getObject() instanceof Detection);
Detection detection = (Detection) binding.getObject();
assertEquals(1, detection.getLocators().length);
InvokerLocator locator = detection.getLocators()[0];
log.info("locator: " + locator);
// Tell server to shut down.
os.write(5);
// Tell server to restart.
os.write(7);
Thread.sleep(4000);
// Get new detection message from JNDI server.
enumeration = listBindings(context, "");
assertTrue(enumeration.hasMore());
binding = (Binding) enumeration.next();
log.info(binding);
assertFalse(enumeration.hasMore());
assertTrue(binding.getObject() instanceof Detection);
detection = (Detection) binding.getObject();
assertEquals(1, detection.getLocators().length);
InvokerLocator newLocator = detection.getLocators()[0];
log.info("new locator: " + newLocator);
// Verify that JNDIDetector has already discovered that old server is dead and
// has registered new server.
assertFalse(locator.equals(newLocator));