Port test for handler's life-cycle processing into master branch.

Port test of https://github.com/netty/netty/pull/1157 into master branch.