@Test public void unsubscribeMessage() throws Exception { messageBusService.unsubscribeMessage(handlerId); Field field = messageBusService.getClass().getDeclaredField("processorManager"); field.setAccessible(true); DispatchManager processorManager = (DispatchManager) field.get(messageBusService); Class processorManagerClass = processorManager.getClass(); Field handlerMapField = processorManagerClass.getDeclaredField("handlerMap"); handlerMapField.setAccessible(true); Map<String, NulsMessageHandler> handlerMap = (Map<String, NulsMessageHandler>) handlerMapField.get(processorManager); assertNull(handlerMap.get(handlerId)); }
@Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); }
MessageBusServiceImpl implements MessageBusService { @Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); } }
MessageBusServiceImpl implements MessageBusService { @Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); }  }
MessageBusServiceImpl implements MessageBusService { @Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); }  @Override String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandler); @Override void unsubscribeMessage(String subscribeId); @Override void receiveMessage(BaseMessage message, Node node); void shutdown(); @Override Result<List<String>> broadcast(BaseMessage message, Node excludeNode, boolean aysn, int percent); @Override Result sendToNode(BaseMessage message, Node node, boolean aysn); @Override Result<? extends BaseMessage> getMessageInstance(short moduleId, int type); }
MessageBusServiceImpl implements MessageBusService { @Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); }  @Override String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandler); @Override void unsubscribeMessage(String subscribeId); @Override void receiveMessage(BaseMessage message, Node node); void shutdown(); @Override Result<List<String>> broadcast(BaseMessage message, Node excludeNode, boolean aysn, int percent); @Override Result sendToNode(BaseMessage message, Node node, boolean aysn); @Override Result<? extends BaseMessage> getMessageInstance(short moduleId, int type);  }