public void testStateResponseWhileRestartingBrokenTransfers() throws Throwable {
MagicKey k1 = new MagicKey("k1", cache(1), cache(2), cache(3));
cache(0).put(k1, "v1");
final StateTransferManager stm = cache(0).getAdvancedCache().getComponentRegistry().getStateTransferManager();
final int initialTopologyId = stm.getCacheTopology().getTopologyId();
final CheckPoint checkPoint = new CheckPoint();
replaceInvocationHandler(checkPoint, manager(0), StateResponseCommand.class);
replaceInvocationHandler(checkPoint, manager(1), StateRequestCommand.class);
replaceInvocationHandler(checkPoint, manager(2), StateRequestCommand.class);
log.debugf("Killing node %s", address(3));
cache(3).stop();
eventually(new Condition() {
@Override
public boolean isSatisfied() throws Exception {
// Wait for the rebalance cache topology to be installed
return stm.getCacheTopology().getTopologyId() == initialTopologyId + 2;
}
});
// Allow cache 0 to request transactions from caches 1 and 2 (in any order)
checkPoint.trigger("OUT_GET_TRANSACTIONS_" + address(1));