code: def test_proxy_manager_lifecycle(shutdown_only):
      """
      Creates a ProxyManager and tests basic handling of the lifetime of a
      specific RayClient Server. It checks the following properties:
      1. The SpecificServer is created using the first port.
      2. The SpecificServer comes alive and has a log associated with it.
      3. The SpecificServer destructs itself when no client connects.
      4. The ProxyManager returns the port of the destructed SpecificServer.
      """
      proxier.CHECK_PROCESS_INTERVAL_S = 1
      os.environ["TIMEOUT_FOR_SPECIFIC_SERVER_S"] = "5"
      pm, free_ports = start_ray_and_proxy_manager(n_ports=2)
      client = "client1"
  
      pm.create_specific_server(client)
      assert pm.start_specific_server(client, JobConfig())
      # Channel should be ready and corresponding to an existing server
      grpc.channel_ready_future(pm.get_channel(client)).result(
          timeout=5
      )
  
      proc = pm._get_server_for_client(client)
      assert proc.port == free_ports[0], f"Free Ports are: {free_ports}"
  
      log_files_path = os.path.join(
          pm.node.get_session_dir_path(), "logs", "ray_client_server*"
      )
      files = glob(log_files_path)
      assert any(str(free_ports[0]) in f for f in files)
  
      proc.process_handle_future.result().process.wait(10)
      # Wait for reconcile loop
      time.sleep(2)
  
      assert len(pm._free_ports) == 2
      assert pm._get_unused_port() == free_ports[1]
  
imports: import json
  import os
  import random
  import sys
  import time
  from glob import glob
  from unittest.mock import patch, MagicMock
  from itertools import chain
  import grpc
  import pytest
  import ray
  import ray.core.generated.ray_client_pb2
  import ray.util.client.server.proxier
  from ray._private.ray_constants import REDIS_DEFAULT_PASSWORD
  from ray._private.test_utils import run_string_as_driver, wait_for_condition
  from ray.cloudpickle.compat import pickle
  from ray.job_config import JobConfig
label_desc: Use image node_id 2 for calling a global function with example usage: test_proxy_manager_lifecycle(shutdown_only) without return types