servers.get(2).start();
servers.get(3).start();
servers.get(4).start();
servers.get(5).start();
ServerLocatorImpl locator = (ServerLocatorImpl)getServerLocator(0);
Topology topology = locator.getTopology();
// for logging and debugging
topology.setOwner("testMultipleFailovers");
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
locator.setReconnectAttempts(-1);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
int backupNode;
ClientSession session = sendAndConsume(sf, true);
log.info("failing node 0");
servers.get(0).crash(session);
session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
log.info("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
log.info("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
log.info("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
log.info("failing node " + backupNode);
servers.get(backupNode).crash(session);
session.close();
backupNode = waitForNewLive(5, false, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false);
session.close();
servers.get(backupNode).stop();
locator.close();
}