@Test public void testAddStickyCmd() throws Exception { router.addStickyCmd(SampleCmd.NOTIFY_PRICE.getValue(),packetValidator); SamplePacket packet = new SamplePacket(SampleCmd.NOTIFY_PRICE.getValue(),ByteString.encodeUtf8("{}")); router.route(SampleCmd.NOTIFY_PRICE.getValue(),packet); router.subscribe(this, SampleCmd.NOTIFY_PRICE.getValue(), new ResponseHandler() { @Override public void sendSuccessMessage(int command, ByteString requestBody, Packet responsePacket) { receivePacket = (SamplePacket) responsePacket; } @Override public void sendFailureMessage(int command, Throwable error) { } }); assertNull(receivePacket); packet = new SamplePacket(SampleCmd.NOTIFY_PRICE.getValue(),ByteString.encodeUtf8("{\"code\" : 200}")); router.route(SampleCmd.NOTIFY_PRICE.getValue(),packet); assertNotNull(receivePacket); }
@Override public void addStickyCmd(int cmd,PacketValidator triggerPacketValidator) { stickyCmds.add(new StickyContext(cmd, triggerPacketValidator)); }
DefaultOne2ManyNotifyRouter implements One2ManyNotifyRouter { @Override public void addStickyCmd(int cmd,PacketValidator triggerPacketValidator) { stickyCmds.add(new StickyContext(cmd, triggerPacketValidator)); } }
DefaultOne2ManyNotifyRouter implements One2ManyNotifyRouter { @Override public void addStickyCmd(int cmd,PacketValidator triggerPacketValidator) { stickyCmds.add(new StickyContext(cmd, triggerPacketValidator)); }  }
DefaultOne2ManyNotifyRouter implements One2ManyNotifyRouter { @Override public void addStickyCmd(int cmd,PacketValidator triggerPacketValidator) { stickyCmds.add(new StickyContext(cmd, triggerPacketValidator)); }  @Override void addStickyCmd(int cmd,PacketValidator triggerPacketValidator); @Override void removeStickyCmd(int command); @Override void subscribe(Object tag, int cmd, ResponseHandler responseHandler); @Override void unsubscribe(Object tagOrResponseHandler); @Override void route(int command, Packet packet); void sendSuccessMessage(NotifyContext notifyContext, int command, Packet packet); }
DefaultOne2ManyNotifyRouter implements One2ManyNotifyRouter { @Override public void addStickyCmd(int cmd,PacketValidator triggerPacketValidator) { stickyCmds.add(new StickyContext(cmd, triggerPacketValidator)); }  @Override void addStickyCmd(int cmd,PacketValidator triggerPacketValidator); @Override void removeStickyCmd(int command); @Override void subscribe(Object tag, int cmd, ResponseHandler responseHandler); @Override void unsubscribe(Object tagOrResponseHandler); @Override void route(int command, Packet packet); void sendSuccessMessage(NotifyContext notifyContext, int command, Packet packet);  }