@Test
public void testMany() throws InterruptedException {
MessageTree tree = buildMessages();
PlainTextMessageCodec codec = new PlainTextMessageCodec();
ChannelBuffer buf = ChannelBuffers.dynamicBuffer(8192);
codec.encode(tree, buf);
buf.readInt();
buf.markReaderIndex();
long current = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
MessageTree tree2 = new DefaultMessageTree();
codec.decode(buf, tree2);
buf.resetReaderIndex();
}
System.out.println("Cost:" + (System.currentTimeMillis() - current));
Thread.sleep(1000);