# Path: misc/client.py
# def readline(sock):
# def readexact(sock, size):
#     def __init__(self, sock):
#     def read_status_line(self):
#     def read_headers(self):
#     def encoding(self):
#     def read_body(self):
#     def json(self):
#     def __init__(self, addr):
#     def maybe_connect(self):
#     def putline(self, line=None):
#     def putclose(self, data):
#     def putrequest(self, method, path, query_string=None):
#     def request(self, method, path, query_string=None, headers=None,
#                 body=None):
#     def putheader(self, name, value):
#     def endheaders(self, body=None):
#     def getresponse(self):
#     def close(self):
# def chunked_encoder(data):
# class Response:
# class Connection:


import subprocess
import sys
import signal
import atexit
import os
import time
import integration_tests.common  # noqa
import integration_tests.generators  # noqa
from misc import client  # noqa
        '--kit', 'platform', '--disable-response-cache'])

    os.putenv('MALLOC_TRIM_THRESHOLD_', '0')
    server = integration_tests.common.start_server(
        'integration_tests/dump.py', path='.test/longrun', sanitize=False)
    os.unsetenv('MALLOC_TRIM_THRESHOLD_')

    os.makedirs('.collector', exist_ok=True)

    os.putenv('COLLECTOR_FILE', '.collector/{}.json'.format(server.pid))
    collector = subprocess.Popen([
        sys.executable, 'misc/collector.py', str(server.pid)])
    os.unsetenv('COLLECTOR_FILE')

    def cleanup(*args):
        try:
            server.terminate()
            assert server.wait() == 0
        finally:
            atexit.unregister(cleanup)

    atexit.register(cleanup)
    signal.signal(signal.SIGINT, cleanup)


def run():
    time.sleep(2)
    for reverse in [True, False]:
        for combination in integration_tests.generators.generate_combinations(
          reverse=reverse):

# Path: misc/client.py
# def readline(sock):
# def readexact(sock, size):
#     def __init__(self, sock):
#     def read_status_line(self):
#     def read_headers(self):
#     def encoding(self):
#     def read_body(self):
#     def json(self):
#     def __init__(self, addr):
#     def maybe_connect(self):
#     def putline(self, line=None):
#     def putclose(self, data):
#     def putrequest(self, method, path, query_string=None):
#     def request(self, method, path, query_string=None, headers=None,
#                 body=None):
#     def putheader(self, name, value):
#     def endheaders(self, body=None):
#     def getresponse(self):
#     def close(self):
# def chunked_encoder(data):
# class Response:
# class Connection:


# Path: integration_tests/longrun.py
import subprocess
import sys
import signal
import atexit
import os
import time
import integration_tests.common  # noqa
import integration_tests.generators  # noqa
from misc import client  # noqa

        '--kit', 'platform', '--disable-response-cache'])

    os.putenv('MALLOC_TRIM_THRESHOLD_', '0')
    server = integration_tests.common.start_server(
        'integration_tests/dump.py', path='.test/longrun', sanitize=False)
    os.unsetenv('MALLOC_TRIM_THRESHOLD_')

    os.makedirs('.collector', exist_ok=True)

    os.putenv('COLLECTOR_FILE', '.collector/{}.json'.format(server.pid))
    collector = subprocess.Popen([
        sys.executable, 'misc/collector.py', str(server.pid)])
    os.unsetenv('COLLECTOR_FILE')

    def cleanup(*args):
        try:
            server.terminate()
            assert server.wait() == 0
        finally:
            atexit.unregister(cleanup)

    atexit.register(cleanup)
    signal.signal(signal.SIGINT, cleanup)


def run():
    time.sleep(2)
    for reverse in [True, False]:
        for combination in integration_tests.generators.generate_combinations(
          reverse=reverse):

            conn = client.Connection('localhost:8080')