JmxUtil { public static void removeMBeanRegistrationListener(MBeanServerConnection pServer,NotificationListener pListener) { try { pServer.removeNotificationListener(JmxUtil.getMBeanServerDelegateName(), pListener); } catch (ListenerNotFoundException e) { } catch (InstanceNotFoundException e) { throw new IllegalStateException("Cannot find " + getMBeanServerDelegateName() + " in server " + pServer,e); } catch (IOException e) { throw new IllegalStateException("IOException while registering notification listener for " + getMBeanServerDelegateName(),e); } } private  JmxUtil(); static ObjectName newObjectName(String pName); static void addMBeanRegistrationListener(MBeanServerConnection pServer, NotificationListener pListener,
                                                    ObjectName pObjectNameToFilter); static void removeMBeanRegistrationListener(MBeanServerConnection pServer,NotificationListener pListener);  }
@Test public void unknowListenerDeregistrationShouldBeSilentlyIgnored() { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); JmxUtil.removeMBeanRegistrationListener(server,this); }