{
Object service = new TwoRemoteCallsWithResultService();
boolean processed = processor.process(service);
assertTrue(processed);
LocalSession remote1 = bayeuxServer.newLocalSession("remoteCall1");
remote1.handshake();
LocalSession remote2 = bayeuxServer.newLocalSession("remoteCall2");
remote2.handshake();
final CountDownLatch latch = new CountDownLatch(2);
final List<Message> responses = new ArrayList<>();
ClientSessionChannel channel1 = remote1.getChannel(Channel.SERVICE + TwoRemoteCallsWithResultService.CHANNEL);
channel1.addListener(new ClientSessionChannel.MessageListener()
{
@Override
public void onMessage(ClientSessionChannel channel, Message message)
{
if (message.isPublishReply())
return;
responses.add(message);
latch.countDown();
}
});
ClientSessionChannel channel2 = remote2.getChannel(Channel.SERVICE + TwoRemoteCallsWithResultService.CHANNEL);
channel2.addListener(new ClientSessionChannel.MessageListener()
{
@Override
public void onMessage(ClientSessionChannel channel, Message message)
{