code: def test_customized_channel():
      try:
          _default_channel = get_default_trial_command_channel()
  
          class TestChannel(TrialCommandChannel):
              def receive_parameter(self):
                  return {"parameter_id": 123, "parameters": {"x": 0}}
  
              def send_metric(self, *args, **kwargs):
                  assert kwargs.get("type") == "FINAL"
                  assert kwargs.get("parameter_id") == 123
                  assert kwargs.get("value") == 456
                  self._received = True
  
          set_default_trial_command_channel(TestChannel())
          assert nni.get_next_parameter()["x"] == 0
          nni.report_final_result(456)
          assert get_default_trial_command_channel()._received
  
      finally:
          set_default_trial_command_channel(_default_channel)
  
imports: import pytest
  import nni
  from nni.trial import overwrite_intermediate_seq
  from nni.runtime.trial_command_channel import TrialCommandChannel, set_default_trial_command_channel, get_default_trial_command_channel
label_desc: Use image node_id 2 for calling a global function with example usage: test_customized_channel() and returns: dict