title: Bidirectional messaging with request-response pattern (Protobuf for data serialization)
body: <p>The base problem is as follows:</p>
  
  <ul>
  <li>Two nodes communicating over a <strong>single</strong> socket;</li>
  <li>Request-reply pattern;</li>
  <li>Both nodes are client and server, i.e. node A makes requests to node B and node B makes requests to node A;</li>
  </ul>
  
  <p>This would be easily solved with two sockets but I have only one. You can think of the problem as having to create multiple <em>virtual sockets/channels</em> over a single socket. <strong>Do you know of a well-tested messaging library that would support such use case?</strong></p>
  
  <hr>
  
  <p>In addition:</p>
  
  <ul>
  <li>Support for C++ and Java;</li>
  <li>The data serialization is handled by me using Google Protocol Buffers; and</li>
  <li>If it is possible to achieve all this using RPC then great, otherwise I'll manage using protobuf.</li>
  </ul>
  
  <p>I'd prefer not to have to write my own library and use something which is well-tested and well-support. I've looked into ZeroMQ but it doesn't seem to support the third requirement (request-reply pattern from A to B and from B to A simultaneously over a single socket). RabbitMQ is another possibility but may not support this requirement either. (I don't have experience with these libraries so maybe I'm wrong...)</p>
  
  <p>(I wonder if I'm asking for too much.)</p>