Protected the connection state of the ZmqNamedProxy socket with a lock.

Should prevent race conditions when sending messages concurrently
connections and disconnections.