@Test public void testNotifications() throws Exception { TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString()); TransportConfiguration acceptorConfig2 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString()); Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addAcceptorConfiguration(acceptorConfig2); ActiveMQServer service = createServer(false, config); service.setMBeanServer(mbeanServer); service.start(); AcceptorControl acceptorControl = createManagementControl(acceptorConfig2.getName()); SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener(); service.getManagementService().addNotificationListener(notifListener); Assert.assertEquals(0, notifListener.getNotifications().size()); acceptorControl.stop(); Assert.assertEquals(usingCore() ? 5 : 1, notifListener.getNotifications().size()); Notification notif = notifListener.getNotifications().get(usingCore() ? 2 : 0); Assert.assertEquals(CoreNotificationType.ACCEPTOR_STOPPED, notif.getType()); Assert.assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()); acceptorControl.start(); Assert.assertEquals(usingCore() ? 10 : 2, notifListener.getNotifications().size()); notif = notifListener.getNotifications().get(usingCore() ? 7 : 1); Assert.assertEquals(CoreNotificationType.ACCEPTOR_STARTED, notif.getType()); Assert.assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()); }