title: Java NIO select() returns without selected keys - why?
body: <p>In writing some test code I have found that Selector.select() can return without Selector.selectedKeys() containing any keys to process. This is happening in a tight loop when I register an accept()ed channel with</p>
  
  <pre>SelectionKey.OP_READ | SelectionKey.OP_CONNECT</pre>
  
  <p>as the operations of interest.</p>
  
  <p>According to the docs, select() should return when:</p>
  
  <p>1) There are channels that can be acted upon.</p>
  
  <p>2) You explicitly call Selector.wakeup() - no keys are selected.</p>
  
  <p>3) You explicitly Thread.interrupt() the thread doing the select() - no keys are selected.</p>
  
  <p>If I get no keys after the select() I must be in cases (2) and (3). However, my code is not calling wakeup() or interrupt() to initiate these returns.</p>
  
  <p>Any ideas as to what is causing this behaviour?</p>