title: Full duplex TCP connection without NIO impossible?
body: <p>I have two separate java processes communicating over a single TCP connection. The protocol is <em>not</em> a simple synchronous request/response one like HTTP. Both sides may independently initiate requests and send data. I want to implement this using threads and blocking sockets, avoiding NIO. But is this even possible?</p>
  
  <p>Java sockets (java.net.Socket) are not threadsafe, so i'm not allowed to read from the socket in one thread while simultaneously writing to it in another thread. (Is this true?) This restriction obviously leads to the possibility of deadlock, when both sides are blocked writing to the socket.</p>
  
  <p>It follows that certain protocols on top of TCP can't be implemented in java without using NIO, or am i missing a point?</p>
  
  <p>Thank you.</p>