title: Overloadable boost::asio::basic_stream_socket
body: <p>Developing a network application, I have a Connection class that manages sending and receiving messages on the network. I'm using boost::asio.</p>
  
  <p>I now want to let the Connection class handle connections both over TCP, and over local UNIX stream sockets. However, the template-design of boost confuses me. AFAICT, there's no shared base-class between local::stream_protocol::socket and ip::tcp::socket.</p>
  
  <p>How would I go about creating a Connection that encapsulates the network-semantics such that other code don't have to deal with the details of what protocol is used?</p>
  
  <p>I.E. I want to implemented something like:</p>
  
  <pre><code>class Connection() {
    Connection(ip::tcp::endpoint&amp; ep);
    Connection(local::stream_protocol::endpoint&amp; ep);
  
    void send(Buffer&amp; buf);
  }
  </code></pre>
  
  <p>How would I achieve this?</p>