@Test public void testSendAsync() { CountDownLatch latch1 = new CountDownLatch(1); CompletableFuture<Void> response = netty1.sendAsync(ep2, "test-subject", "hello world".getBytes()); response.whenComplete((r, e) -> { assertNull(e); latch1.countDown(); }); Uninterruptibles.awaitUninterruptibly(latch1); CountDownLatch latch2 = new CountDownLatch(1); response = netty1.sendAsync(invalidEndPoint, "test-subject", "hello world".getBytes()); response.whenComplete((r, e) -> { assertNotNull(e); latch2.countDown(); }); Uninterruptibles.awaitUninterruptibly(latch2); }
@Override public CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload) { checkPermission(CLUSTER_WRITE); InternalMessage message = new InternalMessage(preamble, messageIdGenerator.incrementAndGet(), localEp, type, payload); return sendAsync(ep, message); }
NettyMessagingManager implements MessagingService { @Override public CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload) { checkPermission(CLUSTER_WRITE); InternalMessage message = new InternalMessage(preamble, messageIdGenerator.incrementAndGet(), localEp, type, payload); return sendAsync(ep, message); } }
NettyMessagingManager implements MessagingService { @Override public CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload) { checkPermission(CLUSTER_WRITE); InternalMessage message = new InternalMessage(preamble, messageIdGenerator.incrementAndGet(), localEp, type, payload); return sendAsync(ep, message); }  }
NettyMessagingManager implements MessagingService { @Override public CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload) { checkPermission(CLUSTER_WRITE); InternalMessage message = new InternalMessage(preamble, messageIdGenerator.incrementAndGet(), localEp, type, payload); return sendAsync(ep, message); }  @Activate void activate(); @Deactivate void deactivate(); @Override CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload); @Override CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload); @Override CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload, Executor executor); @Override void registerHandler(String type, BiConsumer<Endpoint, byte[]> handler, Executor executor); @Override void registerHandler(String type, BiFunction<Endpoint, byte[], byte[]> handler, Executor executor); @Override void registerHandler(String type, BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> handler); @Override void unregisterHandler(String type); }
NettyMessagingManager implements MessagingService { @Override public CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload) { checkPermission(CLUSTER_WRITE); InternalMessage message = new InternalMessage(preamble, messageIdGenerator.incrementAndGet(), localEp, type, payload); return sendAsync(ep, message); }  @Activate void activate(); @Deactivate void deactivate(); @Override CompletableFuture<Void> sendAsync(Endpoint ep, String type, byte[] payload); @Override CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload); @Override CompletableFuture<byte[]> sendAndReceive(Endpoint ep, String type, byte[] payload, Executor executor); @Override void registerHandler(String type, BiConsumer<Endpoint, byte[]> handler, Executor executor); @Override void registerHandler(String type, BiFunction<Endpoint, byte[], byte[]> handler, Executor executor); @Override void registerHandler(String type, BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> handler); @Override void unregisterHandler(String type);  }