Fix a bug in NioSocketChannel.doWrite() where flush() triggered from a ChannelFutureListener is ignored

- Fixes #1679