Gateway gateway = new Gateway(GATEWAY_PORT, _zk.getServerPort());
gateway.start();
final ZkClient zkGatewayClient = ZkKattaUtil.startZkClient(gatewayConf, 30000);
InteractionProtocol gatewayProtocol = new InteractionProtocol(zkGatewayClient, gatewayConf);
FileUtil.deleteFolder(new NodeConfiguration().getShardFolder());
final Node node = new Node(gatewayProtocol, new LuceneServer());
node.start();
// check node-master link
master.start();
TestUtil.waitUntilLeaveSafeMode(master);
TestUtil.waitUntilNumberOfLiveNode(_protocol, 1);
assertEquals(1, _protocol.getLiveNodes().size());
// now break the node connection
gateway.stop();
TestUtil.waitUntilNumberOfLiveNode(_protocol, 0);
// now fix the node connection
gateway.start();
TestUtil.waitUntilNumberOfLiveNode(_protocol, 1);
// cleanup
node.shutdown();
master.shutdown();
zkGatewayClient.close();
gateway.stop();
}