@Test public void testSendRequestWithCallback() throws IOException { given(messageIdGenerator.nextId()).willReturn(25); var responseCallback = Mockito.mock(RpcListener.ResponseCallback.class); var message = new RequestMessage.Builder("test"); packStream.send(message, responseCallback); var argumentCaptor = ArgumentCaptor.forClass(RequestMessage.class); verify(rpcSender).send(argumentCaptor.capture()); assertEquals("test", argumentCaptor.getValue().getMethod()); verify(messageIdGenerator).nextId(); assertEquals(25, argumentCaptor.getValue().getId()); verify(rpcListener).listenForResponse(25, responseCallback); }
@Override public void send(Message message) throws IOException { log.debug("Sending message: {}", message); rpcSender.send(message); }
PackStream implements RpcStreamer { @Override public void send(Message message) throws IOException { log.debug("Sending message: {}", message); rpcSender.send(message); } }
PackStream implements RpcStreamer { @Override public void send(Message message) throws IOException { log.debug("Sending message: {}", message); rpcSender.send(message); } PackStream(RpcSender rpcSender, RpcListener rpcListener);  PackStream(RpcSender rpcSender, RpcListener rpcListener, MessageIdGenerator messageIdGenerator); }
PackStream implements RpcStreamer { @Override public void send(Message message) throws IOException { log.debug("Sending message: {}", message); rpcSender.send(message); } PackStream(RpcSender rpcSender, RpcListener rpcListener);  PackStream(RpcSender rpcSender, RpcListener rpcListener, MessageIdGenerator messageIdGenerator); @Override void attach(RpcConnection rpcConnection); @Override void send(Message message); @Override void send(RequestMessage.Builder requestMessage); @Override void send(RequestMessage.Builder requestMessage, RpcListener.ResponseCallback responseCallback); @Override void addRequestCallback(RpcListener.RequestCallback requestCallback); @Override void removeRequestCallback(RpcListener.RequestCallback requestCallback); @Override void addNotificationCallback(RpcListener.NotificationCallback notificationCallback); @Override void removeNotificationCallback(RpcListener.NotificationCallback notificationCallback); @Override void stop(); }
PackStream implements RpcStreamer { @Override public void send(Message message) throws IOException { log.debug("Sending message: {}", message); rpcSender.send(message); } PackStream(RpcSender rpcSender, RpcListener rpcListener);  PackStream(RpcSender rpcSender, RpcListener rpcListener, MessageIdGenerator messageIdGenerator); @Override void attach(RpcConnection rpcConnection); @Override void send(Message message); @Override void send(RequestMessage.Builder requestMessage); @Override void send(RequestMessage.Builder requestMessage, RpcListener.ResponseCallback responseCallback); @Override void addRequestCallback(RpcListener.RequestCallback requestCallback); @Override void removeRequestCallback(RpcListener.RequestCallback requestCallback); @Override void addNotificationCallback(RpcListener.NotificationCallback notificationCallback); @Override void removeNotificationCallback(RpcListener.NotificationCallback notificationCallback); @Override void stop(); static final Logger log; }