ObjectName delegateName =
new ObjectName("JMImplementation:type=MBeanServerDelegate");
server.addNotificationListener(delegateName, listenerName1, null, "handback1");
server.addNotificationListener(delegateName, listenerName2, null, "handback2");
server.addNotificationListener(delegateName, listenerName2, null, "handback3");
server.removeNotificationListener(delegateName, listenerName2, null, "handback3");
// force notification
server.registerMBean(new Test(), new ObjectName(":foo=bar"));
assertTrue("Listener1 should get a notification", listener1.count == 1);
assertTrue("Source should be the delegate", listener1.source.equals(delegateName));