title: Python stomp.py on_heartbeat_timeout handling
body: <p>I'm working on a stomp consumer's handling of termination events (on_heartbeat_timeout and on_disconnected).  My on_heartbeat_timeout looks like:</p>
  
  <pre><code>def on_heartbeat_timeout(self):
      logger.debug("Heartbeat timed out - attempting a reconnect")
      for n in range(1, 31):
          try:
              logger.debug("Reconnecting: Attempt %d" % n)
              self.conn.set_listener('', self)
              self.conn.start()
              self.conn.connect('admin', 'password', wait=True)
              conn.subscribe('/queue/BVEvent', id=uuid.uuid4())
              logger.debug("Connected")
              break
          except exception.ConnectFailedException:
              _, e, _ = sys.exc_info()
              # Oh, still can't reconnect
              logger.error("Reconnect attempt failed: %s" % e)
              time.sleep(2)
  </code></pre>
  
  <p>I'm forcing the condition by SIGKILL to the message broker, and the on_heartbeat_timeout is triggering.  I'm restarting the broker, but until I restart I get from the stomp.py logging (as expected) indications that the host is refusing connections.  However when i restart the broker..</p>
  
  <pre><code>2016-05-16 11:07:42,969:__main__:ERROR   :StompReceiverThread-3:77:Reconnect attempt failed:
  2016-05-16 11:07:44,969:__main__:DEBUG   :StompReceiverThread-3:67:Reconnecting: Attempt 4
  2016-05-16 11:07:44,969:stomp.py:INFO    :StompReceiverThread-3:655:Attempting connection to host bvesb, port 61690
  2016-05-16 11:07:44,972:stomp.py:INFO    :StompReceiverThread-3:689:Established connection to host bvesb, port 61690
  2016-05-16 11:07:44,972:stomp.py:INFO    :Thread-4  :300:Starting receiver loop
  2016-05-16 11:07:44,973:stomp.py:DEBUG   :StompReceiverThread-  3:245:Sending frame ['STOMP', '\n', 'accept-version:1.1\n', 'heart-beat:10000,1000\n', 'login:admin\n', 'passcode:password\n', '\n', '\x00']
  2016-05-16 11:07:45,181:stomp.py:DEBUG   :StompReceiverThread-4:169:Received frame: 'CONNECTED', headers={'session': 'bvbroker-21b3', 'heart-beat': '100,10000', 'host-id': 'bvbroker', 'version': '1.1', 'user-id': 'admin', 'server': 'apache-apollo/1.7.1'}, body=''
  2016-05-16 11:07:45,182:__main__:DEBUG   :StompReceiverThread-4:43:Connected
  2016-05-16 11:07:45,182:stomp.py:DEBUG   :StompReceiverThread-3:245:Sending frame ['SUBSCRIBE', '\n', 'ack:auto\n', 'destination:/queue/BVEvent\n', 'id:59094787-8f9b-4a0c-92ba-d5612a701e00\n', '\n', '\x00']
  2016-05-16 11:07:45,182:__main__:DEBUG   :StompReceiverThread-3:72:Connected
   2016-05-16 11:07:45,183:stomp.py:INFO    :StompReceiverThread-3:327:Receiver loop ended
  2016-05-16 11:07:46,041:stomp.py:DEBUG   :StompReceiverThread-4:169:Received frame: 'heartbeat', headers={}, body=None
  2016-05-16 11:07:46,042:stomp.py:INFO    :StompReceiverThread-4:327:Receiver loop ended
  </code></pre>
  
  <p>As far as I can tell, the receiver loop is getting terminated and of course I no longer receive messages from the broker.</p>
  
  <p>Any suggestions as to what I'm doing wrong here?</p>