}
};
NotificationFilter filter = null;
Object handback = null;
final ScanState before;
final NotificationEmitter emitter = (NotificationEmitter)
makeNotificationEmitter(proxy,DirectoryScannerMXBean.class);
emitter.addNotificationListener(listener, filter, handback);
before = proxy.getState();
op.call();
try {
final Notification notification =
queue.poll(3000,TimeUnit.MILLISECONDS);
assertEquals(AttributeChangeNotification.ATTRIBUTE_CHANGE,
notification.getType());
assertEquals(AttributeChangeNotification.class,
notification.getClass());
assertEquals(getObjectName(proxy),
notification.getSource());
AttributeChangeNotification acn =
(AttributeChangeNotification)notification;
assertEquals("State",acn.getAttributeName());
assertEquals(ScanState.class.getName(),acn.getAttributeType());
assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
emitter.removeNotificationListener(listener,filter,handback);
} finally {
try {
op.cancel();
} catch (Exception x) {
System.err.println("Failed to cleanup: "+x);