def METHOD_NAME(get_configuration, configure_environment, restart_service):
    '''
    description: Check that RIDS is opened and closed as expected. To do this, it creates injectors(agents and senders)
                 to be able to communicate with the manager. Then, it stops the agents' listening and checks if RIDS is
                 closed(when it`s needed).
    wazuh_min_version: 4.2.0
    tier: 0
    parameters:
        - get_configuration:
            type: fixture
            brief: Get configuration from the module.
        - configure_environment:
            type: fixture
            brief: Configure a custom environment for testing.
        - restart_service:
            type: fixture
            brief: Method to restart the service.
    assertions:
        - Verify that every agent rid is open.
        - Verify that every agent rid is closed.
    input_description: Some metadata is defined in the module. These include some configurations stored in
                       the 'wazuh_manager_conf.yaml'.
    expected_output:
        - The `rids_for_agent_open` boolean variable with `True` when RIDS should be `opened`.
        - The `rids_for_agent_open` boolean variable with `False` when RIDS should be `closed`.
    '''
    metadata = get_configuration.get('metadata')
    agents_number = metadata['agents_number']
    check_close = metadata['check_close']
    agents = create_agents(agents_number, SERVER_ADDRESS, CRYPTO)
    injectors = create_injectors(agents)
    # Let time to remoted store counters for agents
    time.sleep(20)
    process = psutil.Process(get_remoted_pid())
    opened = process.open_files()
    # Check that rids is open
    for agent in agents:
        agent_rids_path = os.path.join(RIDS_DIR, agent.id)
        rids_for_agent_open = False
        for path in opened:
            if agent_rids_path in path:
                rids_for_agent_open = True
                break
        assert rids_for_agent_open, f"Agent fd should be open {agent.id}"
    if True in check_close:
        # Close threads with check close
        for index, injector in enumerate(injectors):
            if check_close[index]:
                injector.stop_receive()
        # Wait that the thread close the rids
        time.sleep(120)
        opened = process.open_files()
        # Check that rids is close
        for agent_index, agent in enumerate(agents):
            agent_rids_path = os.path.join(RIDS_DIR, agents[agent_index].id)
            rids_for_agent_open = False
            for path in opened:
                if agent_rids_path in path:
                    rids_for_agent_open = True
                    break
            if check_close[agent_index]:
                assert not rids_for_agent_open, f"Agent fd should be close {agents[agent_index].id}"
            else:
                assert rids_for_agent_open, f"Agent fd should be open {agents[agent_index].id}"
                # Close thread without check close
                injectors[agent_index].stop_receive()
    else:
        # Close all threads
        for index, injector in enumerate(injectors):
            injector.stop_receive()