code: def test_log4j_cve():
      if sys.version_info[0] < 3:
          print("Skipping log24j_cve test on Python 2.x")
          return
  
      # Open TCP socket to listen on localhost:50001
      sock = None
      for res in socket.getaddrinfo(
          "localhost",
          50001,
          socket.AF_INET,
          socket.SOCK_STREAM,
          0,
          socket.AI_PASSIVE,
      ):
          af, socktype, proto, canonname, sa = res
          try:
              sock = socket.socket(af, socktype, proto)
          except OSError:
              sock = None
              continue
          try:
              sock.bind(sa)
              sock.listen(1)
          except OSError:
              close_quietly(sock)
              sock = None
              continue
          break
      assert sock is not None
  
      t = threading.Thread(target=malicious_log)
      t.start()
  
      # check that we are not receiving any data on this socket
      # if someone just connects (and sends no data) we assume that it originated from this test (the "poison pill")
      # (log4j request would always also send data)
      conn, _ = sock.accept()
      with conn:
          data = conn.recv(10)
          # if we do receive any data - it was H2O's log4j that called us
          called_by_log4j = len(data) > 0
          conn.close()
      close_quietly(sock)
  
      assert not called_by_log4j
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_log4j_cve.py
imports: import sys
  import socket
  import h2o
  from tests import pyunit_utils
  import time
  import threading
label_desc: Use image node_id 4 for calling a global function with example usage: test_log4j_cve() without return types