Source:
<code>public void testInvokeCommandStaggeredToNonMember() throws Exception { UUID randomUuid = UUID.randomUUID(); Address randomAddress = JGroupsAddressCache.fromJGroupsAddress(randomUuid); JGroupsTransport transport = (JGroupsTransport) manager(0).getTransport(); ReplicableCommand command = new ClusteredGetCommand("key", ByteString.fromString("cache"), <START> TestingUtil.getSegmentForKey("key", cache(0)), 0); <END> CompletionStage<Map<Address, Response>> future = transport.invokeCommandStaggered(Collections.singletonList(randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); assertEquals(Collections.singletonMap(randomAddress, CacheNotFoundResponse.INSTANCE), future.toCompletableFuture().get()); CompletionStage<Map<Address, Response>> future2 = transport.invokeCommandStaggered(Arrays.asList(address(1), randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); Map<Object, Object> expected = TestingUtil.mapOf(address(1), CacheNotFoundResponse.INSTANCE, randomAddress, CacheNotFoundResponse.INSTANCE); assertEquals(expected, future2.toCompletableFuture().get()); CompletableFuture<Void> blocker = blockRemoteGets(); try { CompletionStage<Map<Address, Response>> future3 = transport.invokeCommandStaggered(Arrays.asList(address(1), randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); Thread.sleep(500); blocker.complete(null); assertEquals(expected, future3.toCompletableFuture().get()); } finally { blocker.complete(null); } }</code><technical_language>Off-topic: please change ByteString.fromString("cache") CACHE_NAME</technical_language>

Target:
public void testInvokeCommandStaggeredToNonMember() throws Exception { UUID randomUuid = UUID.randomUUID(); Address randomAddress = JGroupsAddressCache.fromJGroupsAddress(randomUuid); JGroupsTransport transport = (JGroupsTransport) manager(0).getTransport(); ReplicableCommand command = new ClusteredGetCommand("key", CACHE_NAME, 0, 0); CompletionStage<Map<Address, Response>> future = transport.invokeCommandStaggered(Collections.singletonList(randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); assertEquals(Collections.singletonMap(randomAddress, CacheNotFoundResponse.INSTANCE), future.toCompletableFuture().get()); CompletionStage<Map<Address, Response>> future2 = transport.invokeCommandStaggered(Arrays.asList(address(1), randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); Map<Object, Object> expected = TestingUtil.mapOf(address(1), CacheNotFoundResponse.INSTANCE, randomAddress, CacheNotFoundResponse.INSTANCE); assertEquals(expected, future2.toCompletableFuture().get()); CompletableFuture<Void> blocker = blockRemoteGets(); try { CompletionStage<Map<Address, Response>> future3 = transport.invokeCommandStaggered(Arrays.asList(address(1), randomAddress), command, MapResponseCollector.ignoreLeavers(), DeliverOrder.NONE, 5, TimeUnit.SECONDS); Thread.sleep(500); blocker.complete(null); assertEquals(expected, future3.toCompletableFuture().get()); } finally { blocker.complete(null); } }