@Override
    protected void encode(ChannelHandlerContext ctx, HTTPRequest req, ByteBuf buf)
        throws Exception {
      InetSocketAddress addr = (InetSocketAddress) ctx.channel().remoteAddress();

      ByteBufOutputStream oup = new ByteBufOutputStream(buf);
      server.new HTTPSession(req, oup, addr.getAddress(), true);
    }
  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) {
    Channel child = (Channel) msg;

    JSONAPI.dbug("channelRead pipeline hashcode: " + ctx.channel().pipeline().hashCode());

    child.pipeline().addFirst(new JSONAPIChannelDecoder(api));
    this.eventGroup.register(child);

    ctx.fireChannelRead(msg);
  }