@@ -0,0 +1,1344 @@
+#!/usr/bin/env python3%0A%0Afrom subprocess import Popen%0Afrom test_common import *%0Aimport socket, ssl, time, os, signal%0A%0Aif __name__ == %22__main__%22:%0A  ghostunnel = None%0A  try:%0A    # create certs%0A    root = RootCert('root')%0A    root.create_signed_cert('client')%0A%0A    # start ghostunnel server with false as child%0A    ghostunnel = run_ghostunnel(%5B'server', '--listen=%7B0%7D:13001'.format(LOCALHOST),%0A      '--target=%7B0%7D:13002'.format(LOCALHOST), '--keystore=client.p12',%0A      '--cacert=root.crt', '--status=%7B0%7D:%7B1%7D'.format(LOCALHOST, STATUS_PORT),%0A      '--allow-all', '--', 'nc', '-kl', LOCALHOST, '13002'%5D)%0A%0A    urlopen = lambda path: urllib.request.urlopen(path, cafile='root.crt')%0A%0A    # block until ghostunnel is up%0A    TcpClient(STATUS_PORT).connect(20)%0A%0A    # get child pid%0A    status = json.loads(str(urlopen(%22https://%7B0%7D:%7B1%7D/_status%22.format(LOCALHOST, STATUS_PORT)).read(), 'utf-8'))%0A%0A    # send sigterm to ghostunnel, wait for child to terminate%0A    stopped = False%0A    ghostunnel.terminate()%0A    for n in range(0, 10):%0A      try:%0A        os.kill(status%5B'child_pid'%5D, 0)%0A        print_ok(%22child is still alive%22)%0A      except:%0A        stopped = True%0A        break%0A      time.sleep(1)%0A%0A    if not stopped:%0A      raise Exception('child never terminated')%0A%0A    print_ok(%22child terminated%22)%0A%0A    print_ok(%22OK%22)%0A  finally:%0A    terminate(ghostunnel)%0A

Add test to check tunnel shuts down child