You'll see this pattern repeated in a few places.  Netty uses reference counting for byte buffers.  We pass byte buffers between our inbound and outbound channels (in both directions).  To allow them to be used this way, we need to retain them before handing them off to the other channel.