System.setProperty(KeepAliveManager.KEEP_ALIVE_INTERVAL_TIME_PROPERTY,
"1000");
log.info("Starting server");
JsonRpcServerRabbitMq server = new JsonRpcServerRabbitMq(
new EchoJsonRpcHandler());
server.start();
log.info("Server started");
long initTime = System.nanoTime();
log.info("Starting client");
JsonRpcClientRabbitMq client = new JsonRpcClientRabbitMq();
MediaPipelineFactory mpf = new MediaPipelineFactory(client);
MediaPipeline pipeline = mpf.create();
checkKeepAlives(initTime, NUM_KEEP_ALIVES * 1000,
(NUM_KEEP_ALIVES + 1) * 1000);
// There are two pipelines and NUM_KEEP_ALIVES are submited in the half
// of the time
initTime = System.nanoTime();
latch = new CountDownLatch(NUM_KEEP_ALIVES);
MediaPipeline pipeline2 = mpf.create();
checkKeepAlives(initTime, NUM_KEEP_ALIVES * 1000 / 2,
(NUM_KEEP_ALIVES + 1) * 1000 / 2);
client.close();
log.info("Client finished");
server.destroy();
log.info("Server finished");
}