final Properties clientProperties = new Properties();
clientProperties.setProperty(ClientConfig.LB_TYPE, "static");
clientProperties.setProperty(ClientConfig.LB_SERVER, "localhost:" + suroServer.getServerPort());
clientProperties.setProperty(ClientConfig.CLIENT_TYPE, "sync");
SuroClient client = new SuroClient(clientProperties);
for (int i = 0; i < 10; ++i) {
client.send(new Message("topic1", Integer.toString(i).getBytes()));
}
for (int i = 0; i < 5; ++i) {
client.send(new Message("topic2", Integer.toString(i).getBytes()));
}
for (int i = 0; i < 20; ++i) {
client.send(new Message("topic3", Integer.toString(i).getBytes()));
}
for(int i = 0; i < 30; ++i) {
Map<String, Object> message = makeMessage("foo/bar", "value"+i);
client.send(new Message("topic4", jsonMapper.writeValueAsBytes(message)));
}
int count = 10;
while (!answer() && count > 0) {
Thread.sleep(1000);
--count;
}
assertTrue(answer());
client.shutdown();
} catch (Exception e) {
System.err.println("SuroServer startup failed: " + e.getMessage());
System.exit(-1);
}