title: Netty 4 HttpChunkedInput throws "unexpected message type: DefaultHttpContent" in HttpObjectEncoder
body: <p>I wrote a netty 4.0.33 https file server that is suppose to send files as chucks. The <a href="https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java" rel="nofollow">File-Server-Example</a> Shows when using https to handle the response like this:</p>
  
  <pre><code>// Write the initial line and the header.
  channelHandlerContext.write(httpResponse);
  // Write the content.
  ChannelFuture sendFileFuture;
  sendFileFuture = channelHandlerContext.writeAndFlush(
       new HttpChunkedInput(new ChunkedFile(accessFile, 0, accessFile.length(), 8192)),     
       channelHandlerContext.newProgressivePromise()
  );
  </code></pre>
  
  <p>My file I tested it with is only 270 byts long so the handler immediately fires the complete event, but with an error;</p>
  
  <pre><code>Transfer failed.java.lang.IllegalStateException: unexpected message type: DefaultHttpContent
  </code></pre>
  
  <p>which ich caused by the <strong>HttpObjectEncoder</strong> class that is part of the HttpServerCodec. for some reason the <strong>HttpChunkedInput</strong> passes a <strong>DefaultHttpContent</strong> object that seems to be not allowed.</p>
  
  <p>My Pipe Looks like this</p>
  
  <pre><code>HttpServerCodec
  HttpObjectAggregator
  ChunkedWriteHandler
  FileHandler
  </code></pre>
  
  <p>It looks like a pretty default setup to me. What am I doing wrong here?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I initialized my HttpResponse object for the headers like this:</p>
  
  <pre><code>HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
  </code></pre>