code: def test_msg_dispatcher(self):
      _reverse_io()  # now we are sending to Tuner's incoming stream
      send(CommandType.RequestTrialJobs, "2")
      send(
          CommandType.ReportMetricData,
          '{"parameter_id":0,"type":"PERIODICAL","value":"10"}',
      )
      send(
          CommandType.ReportMetricData,
          '{"parameter_id":1,"type":"FINAL","value":"11"}',
      )
      send(CommandType.UpdateSearchSpace, '{"name":"SS0"}')
      send(CommandType.RequestTrialJobs, "1")
      send(CommandType.KillTrialJob, "null")
      _restore_io()
  
      tuner = NaiveTuner()
      dispatcher = MsgDispatcher("ws://_unittest_placeholder_", tuner)
      dispatcher._channel = LegacyCommandChannel()
      msg_dispatcher_base._worker_fast_exit_on_terminate = False
  
      dispatcher.run()
      e = dispatcher.worker_exceptions[0]
      self.assertIs(type(e), AssertionError)
      self.assertEqual(
          e.args[0], "Unsupported command: CommandType.KillTrialJob"
      )
  
      _reverse_io()  # now we are receiving from Tuner's outgoing stream
      self._assert_params(0, 2, [], None)
      self._assert_params(1, 4, [], None)
  
      self._assert_params(2, 6, [[1, 4, 11, False]], {"name": "SS0"})
  
      self.assertEqual(len(_out_buf.read()), 0)
  
file_path: nni/test/ut/sdk/test_msg_dispatcher.py
imports: import json
  from io import BytesIO
  from unittest import TestCase, main
  from nni.runtime import msg_dispatcher_base
  from nni.runtime.msg_dispatcher import MsgDispatcher
  from nni.runtime.tuner_command_channel.legacy import *
  from nni.tuner import Tuner
  from nni.utils import extract_scalar_reward
label_desc: Use image node_id 1 for calling the MsgDispatcherTestCase obj's underlying member method code with example usage: obj.test_msg_dispatcher() without return types