title: In pyzmq, how do you stop a Proxy?
body: <p>I have a server behind a firewall and a publicly available web server requesting info from the server.  I am using pyzmq to manage the communication between the backend and the web front end.  This work without a proxy in place, when they are communicating locally.  It works when using the proxy.  I can start up a ThreadProxy, but how do I stop it?</p>
  
  <pre><code>import zmq
  from zmq.devices import ThreadProxy
  
  class MyProxy:
      def __init__(self)
          p = ThreadProxy(zmq.ROUTER, zmq.DEALER) # Not using mon
          p.setsockopt_in(zmq.IDENTITY, b'ROUTER')
          p.setsockopt_out(zmq.IDENTITY, b'DEALER')
          p.bind_in('tcp://*:5550')
          p.connect_out('tcp://localhost:5550')
          self._proxy = p
      def start(self)
          self._proxy.start()
      def stop(self)
          ???
  </code></pre>
  
  <p>How do I actually ask that proxy to stop? .join just waits, because the proxy is blocked or has no reason to stop.  I don't have a context to .term().</p>
  
  <p>I would like to run this inside a linux daemon, so "kill" is not the most elegant solution, nor does it give me the control over the proxy I am looking for.</p>