MulticastExchangeNetworker implements ExchangeNetworker { @Override public ExchangeGroup lookup(URL url) throws RemotingException { return new MulticastExchangeGroup(url); }  @Override ExchangeGroup lookup(URL url);  }
@Test public void testJoin() throws RemotingException, InterruptedException { final String groupURL = "multicast: MulticastExchangeNetworker multicastExchangeNetworker = new MulticastExchangeNetworker(); final CountDownLatch countDownLatch = new CountDownLatch(1); Peer peer1 = multicastExchangeNetworker.lookup(URL.valueOf(groupURL)) .join(URL.valueOf("exchange: @Override public CompletableFuture<Object> reply(ExchangeChannel channel, Object msg) throws RemotingException { countDownLatch.countDown(); return super.reply(channel, msg); } }); Peer peer2 = multicastExchangeNetworker.lookup(URL.valueOf(groupURL)) .join(URL.valueOf("exchange: while (true) { for (Channel channel : peer1.getChannels()) { channel.send("hello multicast exchange network!"); } TimeUnit.MILLISECONDS.sleep(50); long count = countDownLatch.getCount(); if (count > 0) { break; } } Group lookup = Networkers.lookup(groupURL); assertThat(lookup, not(nullValue())); assertThat(peer1, instanceOf(ExchangeServerPeer.class)); peer1.close(); peer2.close(); }