Serializer<SenseiRequest, SenseiResult> serializer = CoreSenseiServiceImpl.JAVA_SERIALIZER;
BrokerConfig brokerConfig = new BrokerConfig(senseiConfiguration, balancerFactory, serializer, senseiServerBuilder.getPluginRegistry());
brokerConfig.init();
SenseiBroker senseiBroker = brokerConfig.buildSenseiBroker();
while (true) {
SenseiResult senseiResult = senseiBroker.browse(new SenseiRequest());
int totalDocs = senseiResult.getTotalDocs();
System.out.println("TotalDocs = " + totalDocs);
if (totalDocs >= expectedDocs) {
break;
}