Counter counter = new Counter();
byte hello[] = "hello".getBytes();
long ledger = Long.parseLong(args[2]);
ClientSocketChannelFactory channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
.newCachedThreadPool());
OrderedSafeExecutor executor = new OrderedSafeExecutor(1);
BookieClient bc = new BookieClient(new ClientConfiguration(), channelFactory, executor);
InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));
for (int i = 0; i < 100000; i++) {
counter.inc();
bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter, 0);
}
counter.wait(0);
System.out.println("Total = " + counter.total());
channelFactory.releaseExternalResources();
executor.shutdown();
}