title: Java nio, checking if a channel is ready for read, write
body: <p>Instead of using a selector in the usual way, where for each ready channel a message can be determined and sent, I'd like to choose whichever connection is currently ready and send a message there. </p>
  
  <p>Presumably this can be done by throwing all the channels into a selector for reading and marking them ready for reading if they come out, then doing the same for writing, and then choosing from among those that I've marked ready.</p>
  
  <p>Is this a good idea, is there a better way to do this, and what should I watch out for? For example, the <a href="http://rox-xmlrpc.sourceforge.net/niotut/" rel="nofollow noreferrer">Rox Tutorial</a> states <em>"If you try to mix OP READ and OP WRITE you'll quickly get yourself into trouble. The Sun Windows implementation has been seen to deadlock if you do this."</em> Are there similar gotchas here? What is the best way to implement:</p>
  
  <pre><code>boolean isReadyForRead(SocketChannel c);
  boolean isReadyForWrite(SocketChannel c);
  </code></pre>