code: def stop(self):
          
          with self.__receiver_thread_exit_condition:
              while not self.__receiver_thread_exited and self.is_connected():
                  self.__receiver_thread_exit_condition.wait()
docs: Stop the connection. Performs a clean shutdown by waiting for the
          receiver thread to exit.