StatsServer ss = new StatsServer(p, 8080);
HttpTransceiver trans = new HttpTransceiver(
new URL("http://localhost:" + Integer.parseInt(args[0])));
GenericRequestor req = new GenericRequestor(protocol, trans);
while(true) {
Thread.sleep(1000);
GenericRecord params = new GenericData.Record(protocol.getMessages().get(
"sleep").getRequest());
Random rand = new Random();
params.put("millis", Math.abs(rand.nextLong()) % 1000);
int payloadSize = Math.abs(rand.nextInt()) % 10000;
byte[] payload = new byte[payloadSize];
rand.nextBytes(payload);
params.put("data", ByteBuffer.wrap(payload));
req.request("sleep", params);
}
}