def handler_manager(self, request, inbox_manager, handler):
        # NOTE: this sets all handlers to be the same fn, but this doesn't really
        # make a difference in this context
        hm = SyncHandlerManager(inbox_manager)

        if request.param == "All handlers set, all stopped":
            for handler_name in all_handlers:
                setattr(hm, handler_name, handler)
            hm.stop()
        elif request.param == "All handlers set, receivers stopped, client events running":
            for handler_name in all_handlers:
                setattr(hm, handler_name, handler)
            hm.stop(receiver_handlers_only=True)
        elif request.param == "All handlers set, all running":
            for handler_name in all_handlers:
                setattr(hm, handler_name, handler)
        elif request.param == "Some receiver and client event handlers set, all stopped":
            hm.on_message_received = handler
            hm.on_method_request_received = handler
            hm.on_connection_state_change = handler
            hm.on_new_sastoken_required = handler
            hm.stop()
        elif (request.param ==
              "Some receiver and client event handlers set, receivers stopped, client events running"
              ):
            hm.on_message_received = handler
            hm.on_method_request_received = handler
            hm.on_connection_state_change = handler
            hm.on_new_sastoken_required = handler
            hm.stop(receiver_handlers_only=True)
        elif request.param == "Some receiver and client event handlers set, all running":
            hm.on_message_received = handler
            hm.on_method_request_received = handler
            hm.on_connection_state_change = handler
            hm.on_new_sastoken_required = handler
        elif request.param == "Some receiver handlers set, all stopped":
            hm.on_message_received = handler
            hm.on_method_request_received = handler
            hm.stop()
        elif request.param == "Some receiver handlers set, all running":
            hm.on_message_received = handler
            hm.on_method_request_received = handler
        elif request.param == "Some client event handlers set, all stopped":
            hm.on_connection_state_change = handler
            hm.on_new_sastoken_required = handler
            hm.stop()
        elif request.param == "Some client event handlers set, all running":
            hm.on_connection_state_change = handler
            hm.on_new_sastoken_required = handler

        yield hm
        hm.stop()
 def handler_manager(self, request, inbox_manager, handler):
     hm = SyncHandlerManager(inbox_manager)
     if request.param == "Some receiver handlers running":
         # Set an arbitrary receiver handler
         hm.on_message_received = handler
     elif request.param == "Some client event handlers running":
         # Set an arbitrary client event handler
         hm.on_connection_state_change = handler
     elif request.param == "Some receiver and some client event handlers running":
         # Set an arbitrary receiver and client event handler
         hm.on_message_received = handler
         hm.on_connection_state_change = handler
     elif request.param == "All handlers running":
         # NOTE: this sets all handlers to be the same fn, but this doesn't really
         # make a difference in this context
         for handler_name in all_handlers:
             setattr(hm, handler_name, handler)
     yield hm
     hm.stop()