public void run() {
   ConsumerIterator<byte[], byte[]> it = stream.iterator();
   while (it.hasNext()) {
     MessageAndMetadata<byte[], byte[]> data = it.next();
     byte[] mBytes = data.message();
     Message message = JSONSerializer.INSTANCE.fromBytes(mBytes, Message.class);
     handler.onMessage(message);
   }
 }
 @Override
 protected void doGet(ChannelHandlerContext ctx, HttpRequest httpReq) {
   getCount++;
   processTime();
   QueryStringDecoder reqDecoder = new QueryStringDecoder(httpReq.getUri());
   String data = reqDecoder.parameters().get("data").get(0);
   Payload payload = JSONSerializer.INSTANCE.fromString(data, Payload.class);
   writeJSON(ctx, httpReq, payload);
   this.writeContent(ctx, httpReq, "do get", "text/plain");
 }
 @Override
 protected void doPost(ChannelHandlerContext ctx, HttpRequest httpReq) {
   postCount++;
   processTime();
   FullHttpRequest req = (FullHttpRequest) httpReq;
   ByteBuf byteBuf = req.content();
   byte[] data = new byte[byteBuf.readableBytes()];
   byteBuf.readBytes(data);
   byteBuf.release();
   Payload payload = JSONSerializer.INSTANCE.fromBytes(data, Payload.class);
   writeJSON(ctx, httpReq, payload);
 }
 public static byte[] newPayload(String key, Map<String, String> params, byte[] data) {
   Payload payload = new Payload(key, params, data);
   return JSONSerializer.INSTANCE.toBytes(payload);
 }