throws Exception
{
MBeanServer server = MBeanServerFactory.newMBeanServer();
EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
server.registerMBean(test, invocationHandlerTestName);
NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
proxy.addNotificationListener(this, null, null);
messages.clear();
test.sendNotification();
assertTrue(messages.size() == 1);
proxy.removeNotificationListener(this);
messages.clear();
test.sendNotification();
assertTrue(messages.size() == 0);
}