[JENKINS-24050] Fix issue where cancelled keys cause Jenkins NIO hub to die.

So I don't really have a good unittest, but I'm pretty sure the issue is fixed by checking if the key is valid even before reading, and also handling the CancelledKeyException (for good measure).  The existing tests pass: https://travis-ci.org/kbrowder/remoting/builds/31436797.