reactor/reactor — pull request #166 by wilkinsona (2013-08-28 13:38:44+00:00)
Title: Ensure that read idle does not fire when data's being read

The IdleStateHandler that is added to the pipeline to handle read
idle timeouts was being added as the last handler. Crucially, this
places it after NettyTcpConnectionChannelInboundHandler which does
not pass read events any further down the pipeline, thereby preventing
read events from reaching the IdleStateHandler. This meant that
IdleStateHandler's channelRead method was never being driven causing
it to timeout prematurely.

This problem has been addressed by using addFirst() to add the
IdleStateHandler to the start of the pipeline. This ensures that
it's positioned before NettyTcpConnectionChannelInboundHandler,
receives read events and therefore has its channelRead method driven
as required.

The IdleStateHandler used for write idle timeouts is left in its
position at the end of the pipeline where it will see write events.

The all idle timeout for both the read idle and write idle state
handlers has been set to zero to disable it. The all idle timeout
results in an ALL_IDLE event being fired, but only READ_IDLE and
WRITE_IDLE events were being acted upon.

Unit tests have been added to ensure that read idle does not fire
when data is being read from the connection and that write idle does
not fire when data is being written to the connection.