diff --git a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/NettyJaxrsServer.java b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/NettyJaxrsServer.java
index 04ffb3b..095a3c6 100755
--- a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/NettyJaxrsServer.java
+++ b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/NettyJaxrsServer.java
@@ -2,7 +2,6 @@
 
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.Channel;
-import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelOption;
 import io.netty.channel.ChannelPipeline;
@@ -23,9 +22,9 @@
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
+
 import java.net.InetSocketAddress;
 import java.util.Collections;
-import java.util.List;
 import java.util.Map;
 
 import static org.jboss.resteasy.plugins.server.netty.RestEasyHttpRequestDecoder.Protocol.HTTP;
@@ -62,10 +61,10 @@
    private int backlog = 128;
    // default no idle timeout.
    private int idleTimeout = -1;
-   private List<ChannelHandler> channelHandlers = Collections.emptyList();
+   private ChannelInitializer<SocketChannel> channelInitializer;
    private Map<ChannelOption, Object> channelOptions = Collections.emptyMap();
    private Map<ChannelOption, Object> childChannelOptions = Collections.emptyMap();
-   private List<ChannelHandler> httpChannelHandlers = Collections.emptyList();
+   private ChannelInitializer<SocketChannel> httpInitializer;
 
    public void setSSLContext(SSLContext sslContext)
    {
@@ -151,23 +150,35 @@ public void setIdleTimeout(int idleTimeoutSeconds) {
     }
 
     /**
-     * Add additional {@link io.netty.channel.ChannelHandler}s to the {@link io.netty.bootstrap.ServerBootstrap}.
-     * <p>The additional channel handlers are being added <em>before</em> the HTTP handling.</p>
+     * The channel initializer used to add additional
+     * {@link io.netty.channel.ChannelHandler}s to the
+     * {@link io.netty.bootstrap.ServerBootstrap}.
+     * <p>
+     * The additional channel handlers are being added <em>before</em> the HTTP
+     * handling.
+     * </p>
      *
-     * @param channelHandlers the additional {@link io.netty.channel.ChannelHandler}s.
+     * @param handler the additional {@link io.netty.channel.ChannelHandler}s
+     *            initializer.
      */
-    public void setChannelHandlers(final List<ChannelHandler> channelHandlers) {
-        this.channelHandlers = channelHandlers == null ? Collections.<ChannelHandler>emptyList() : channelHandlers;
+    public void setChannelInitializer(final ChannelInitializer<SocketChannel> handler) {
+        this.channelInitializer = handler;
     }
 
     /**
-     * Add additional {@link io.netty.channel.ChannelHandler}s to the {@link io.netty.bootstrap.ServerBootstrap}.
-     * <p>The additional channel handlers are being added <em>after</em> the HTTP handling.</p>
+     * The channel initializer used add additional
+     * {@link io.netty.channel.ChannelHandler}s to the
+     * {@link io.netty.bootstrap.ServerBootstrap}.
+     * <p>
+     * The additional channel handlers are being added <em>after</em> the HTTP
+     * handling.
+     * </p>
      *
-     * @param httpChannelHandlers the additional {@link io.netty.channel.ChannelHandler}s.
+     * @param handler the additional {@link io.netty.channel.ChannelHandler}s
+     *            initializer.
      */
-    public void setHttpChannelHandlers(final List<ChannelHandler> httpChannelHandlers) {
-        this.httpChannelHandlers = httpChannelHandlers == null ? Collections.<ChannelHandler>emptyList() : httpChannelHandlers;
+    public void setHttpChannelInitializer(final ChannelInitializer<SocketChannel> handler) {
+        this.httpInitializer = handler;
     }
 
     /**
@@ -262,11 +273,13 @@ public void initChannel(SocketChannel ch) throws Exception {
                 }
             };
         } else {
-            final SSLEngine engine = sslContext.createSSLEngine();
-            engine.setUseClientMode(false);
             return new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
+                    final InetSocketAddress addr = ch.remoteAddress();
+                    final SSLEngine engine = sslContext.createSSLEngine(
+                        addr.getAddress().getHostAddress(), addr.getPort());
+                    engine.setUseClientMode(false);
                     ch.pipeline().addFirst(new SslHandler(engine));
                     setupHandlers(ch, dispatcher, HTTPS);
                 }
@@ -276,11 +289,15 @@ public void initChannel(SocketChannel ch) throws Exception {
 
     private void setupHandlers(SocketChannel ch, RequestDispatcher dispatcher, RestEasyHttpRequestDecoder.Protocol protocol) {
         ChannelPipeline channelPipeline = ch.pipeline();
-        channelPipeline.addLast(channelHandlers.toArray(new ChannelHandler[channelHandlers.size()]));
+        if (channelInitializer != null) {
+            channelPipeline.addLast(channelInitializer);
+        }
         channelPipeline.addLast(new HttpRequestDecoder(maxInitialLineLength, maxHeaderSize, maxChunkSize));
         channelPipeline.addLast(new HttpObjectAggregator(maxRequestSize));
         channelPipeline.addLast(new HttpResponseEncoder());
-        channelPipeline.addLast(httpChannelHandlers.toArray(new ChannelHandler[httpChannelHandlers.size()]));
+        if (httpInitializer != null) {
+            channelPipeline.addLast(httpInitializer);
+        }
         channelPipeline.addLast(new RestEasyHttpRequestDecoder(dispatcher.getDispatcher(), root, protocol));
         channelPipeline.addLast(new RestEasyHttpResponseEncoder());
         if (idleTimeout > 0) {
diff --git a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RequestHandler.java b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RequestHandler.java
index 2492c67..3f187ea 100755
--- a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RequestHandler.java
+++ b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RequestHandler.java
@@ -9,6 +9,7 @@
 import io.netty.handler.codec.http.HttpResponse;
 
 import io.netty.handler.timeout.IdleStateEvent;
+import org.apache.commons.io.IOUtils;
 import org.jboss.resteasy.plugins.server.netty.i18n.LogMessages;
 import org.jboss.resteasy.plugins.server.netty.i18n.Messages;
 import org.jboss.resteasy.spi.Failure;
@@ -29,7 +30,7 @@
  * @version $Rev: 2368 $, $Date: 2010-10-18 17:19:03 +0900 (Mon, 18 Oct 2010) $
  */
 @Sharable
-public class RequestHandler extends SimpleChannelInboundHandler
+public class RequestHandler extends SimpleChannelInboundHandler<NettyHttpRequest>
 {
    protected final RequestDispatcher dispatcher;
 
@@ -39,11 +40,9 @@ public RequestHandler(RequestDispatcher dispatcher)
    }
 
    @Override
-   protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception
+   protected void channelRead0(ChannelHandlerContext ctx, NettyHttpRequest request) throws Exception
    {
-      if (msg instanceof NettyHttpRequest) {
-          NettyHttpRequest request = (NettyHttpRequest) msg;
-
+      try {
           if (request.is100ContinueExpected())
           {
              send100Continue(ctx);
@@ -69,6 +68,8 @@ protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Except
           if (!request.getAsyncContext().isSuspended()) {
              response.finish();
           }
+      } finally {
+         IOUtils.closeQuietly(request.getInputStream());
       }
    }
 
diff --git a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RestEasyHttpRequestDecoder.java b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RestEasyHttpRequestDecoder.java
index 07852f0..138bf77 100755
--- a/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RestEasyHttpRequestDecoder.java
+++ b/jaxrs/server-adapters/resteasy-netty4/src/main/java/org/jboss/resteasy/plugins/server/netty/RestEasyHttpRequestDecoder.java
@@ -1,6 +1,7 @@
 package org.jboss.resteasy.plugins.server.netty;
 
 import static io.netty.handler.codec.http.HttpHeaders.is100ContinueExpected;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufInputStream;
 import io.netty.channel.ChannelHandler.Sharable;
@@ -72,9 +73,18 @@ protected void decode(ChannelHandlerContext ctx, io.netty.handler.codec.http.Htt
                
                // Does the request contain a body that will need to be retained
                if(content.content().readableBytes() > 0) {
-                 ByteBuf buf = content.content().retain();
-                 ByteBufInputStream in = new ByteBufInputStream(buf);
-                 nettyRequest.setInputStream(in);
+                    final ByteBuf buf = content.content().retain();
+                    ByteBufInputStream in = new ByteBufInputStream(buf) {
+
+                        public void close() throws java.io.IOException {
+                            try {
+                                buf.release();
+                            } finally {
+                                super.close();
+                            }
+                        };
+                    };
+                    nettyRequest.setInputStream(in);
                }
                
                out.add(nettyRequest); 
