Ported code to Netty 4.0.10.Final