title: Sending and receiving JSON
body: <p>I am using Apache HttpComponets to post data like this to Netty. I use Gson for working JSON.</p>
  
  <pre><code>Request.Post("http://localhost:9090/print").bodyString(getJSon(), ContentType.APPLICATION_JSON),
  </code></pre>
  
  <p>This netty code does not seem to receive the JSON response. I am sure that my code is wrong. What could be the error here ?</p>
  
  <pre><code>@Override
  public void channelRead(ChannelHandlerContext ctx, Object msg)
                                                      throws Exception {
      logger.info( "channelRead" + msg );
      if( msg instanceof HttpRequest ){
          this.request = ( HttpRequest ) msg;
          logger.info( "[" + request.getUri()  + "]");
      }
      if( msg instanceof HttpContent ){
          HttpContent content = (HttpContent)msg;
          ByteBuf buf = content.content();
          logger.info( "[" + buf.toString(CharsetUtil.UTF_8)   + "]");
             if (msg instanceof LastHttpContent) {
                  LastHttpContent trailer = (LastHttpContent) msg;
                  writeResponse( trailer, ctx);
             }
      }
  }
  
  
  
  private boolean writeResponse(HttpObject currentObj, ChannelHandlerContext ctx) {
      logger.info( getJSon() );
      ByteBuf response = Unpooled.copiedBuffer( getJSon(),
                                                CharsetUtil.UTF_8);
  
      ctx.write( response );
      /* Where is 'isKeepAlive' method in the API ? */
      //boolean keepAlive = isKeepAlive(request);
      //keepAlive;
      return false;  
  }
  </code></pre>