public void testScenario_021_11() throws Exception {
assertClusterSize("Wrong cluster size.", 2);
final Object key = "key_s4";
ownerCheckAndInit(cache(1), key, "v");
final ControlledRpcManager rpcManager0 = replaceRpcManager(cache(0));
final BlockingLocalTopologyManager topologyManager0 = replaceTopologyManager(manager(0));
final int currentTopologyId = currentTopologyId(cache(0));
rpcManager0.blockBefore(ClusteredGetCommand.class);
topologyManager0.startBlocking(LatchType.CONSISTENT_HASH_UPDATE);
//consistency check. the remote get is triggered
assertTopologyId(currentTopologyId, cache(0));
Future<Object> remoteGetFuture = remoteGet(cache(0), key);
rpcManager0.waitForCommandToBlock();
NewNode joiner = addNode(LatchType.CONSISTENT_HASH_UPDATE);
topologyManager0.waitToBlock(LatchType.CONSISTENT_HASH_UPDATE);
//wait until the consistent_hash_update arrives in old owner. Also, awaits until the requestor receives the
//rebalance_start.
awaitForTopology(currentTopologyId + 2, cache(1));
awaitForTopology(currentTopologyId + 1, cache(0));
awaitUntilNotInDataContainer(cache(1), key);
joiner.localTopologyManager.waitToBlock(LatchType.CONSISTENT_HASH_UPDATE);
rpcManager0.stopBlocking();
//check the value returned and make sure that the requestor is in the correct topology id (consistency check)
assertEquals("Wrong value from remote get.", "v", remoteGetFuture.get());
assertTopologyId(currentTopologyId + 1, cache(0));
topologyManager0.stopBlocking(LatchType.CONSISTENT_HASH_UPDATE);
joiner.localTopologyManager.stopBlocking(LatchType.CONSISTENT_HASH_UPDATE);
joiner.joinerFuture.get();
}