 
 (defrecord AsyncConnection [s px]
   INNSocket
-
   (bind! [_ endpoint]
     (.bind s endpoint))
   (connect! [_ endpoint]

           (nanomsg.pair PairSocket)
           (nanomsg.bus BusSocket)
           (nanomsg ISocket Socket Nanomsg Device)
           (nanomsg.async IAsyncCallback AsyncSocketProxy))
  (:require [clojure.core.async :refer [chan put!]]))

(def ^:static ^:private supported-sockets

   (let [cls        (-> socktype supported-sockets)
         instance   (.newInstance cls)
         conn       (if (:async opts)
                      (->AsyncConnection instance (AsyncSocket. instance))
                      (->Connection instance))]
     (cond
       (:bind opts) (bind! conn (:bind opts))
