Support reading multiple events that has queued up on the socket.

Hi I like your work, but I had some problems that sometimes multiple commands was read in the same nio read call.

This was not handled, but this pull request fixes that issue. I hope you can accept the pull request.