Fix bug of waitFlushingData logic in NioMessageProcessor. Rewrite the
keepalive logic of NioSession.