# Path: tests/base.py
# class Test(unittest.TestCase):
#     test_timeout = 1
# 
#     def setUp(self):
#         import zorro
#         from zorro import zmq
#         self.z = zorro
#         self.hub = self.z.Hub()
#         self.thread = threading.Thread(target=self.hub.run)
# 
#     def tearDown(self):
#         if not self.hub.stopping:
#             self.hub.stop()
#         self.thread.join(self.test_timeout)
#         if self.thread.is_alive():
#             try:
#                 if not getattr(self, 'should_timeout', False):
#                     raise AssertionError("test timed out")
#             finally:
#                 self.hub.crash()
#                 self.thread.join()
#         for key in list(sys.modules.keys()):
#             if key == 'zorro' or key.startswith('zorro.'):
#                 del sys.modules[key]
# 
# def interactive(zfun):
#     def wrapper(fun):
#         @wraps(fun)
#         def wrapping(self, *a, **kw):
#             self.hub.add_task(partial(zfun, self, *a, **kw))
#             self.thread.start()
#             fun(self, *a, **kw)
#         return wrapping
#     return wrapper


import time
import http.server
        import zorro.http
        import zorro.http
    import unittest
from .base import Test, interactive



class RequestHandler(http.server.BaseHTTPRequestHandler):

    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-Length', '5')
        self.end_headers()
        self.wfile.write(b'HELLO')
        self.wfile.flush()

    def do_FETCH(self):
        self.send_response(200)
        self.send_header('Transfer-Encoding', 'chunked')
        self.end_headers()
        self.wfile.write(b'5\r\nHELLO\r\n0\r\n\r\n')
        self.wfile.flush()



# Path: tests/base.py
# class Test(unittest.TestCase):
#     test_timeout = 1
# 
#     def setUp(self):
#         import zorro
#         from zorro import zmq
#         self.z = zorro
#         self.hub = self.z.Hub()
#         self.thread = threading.Thread(target=self.hub.run)
# 
#     def tearDown(self):
#         if not self.hub.stopping:
#             self.hub.stop()
#         self.thread.join(self.test_timeout)
#         if self.thread.is_alive():
#             try:
#                 if not getattr(self, 'should_timeout', False):
#                     raise AssertionError("test timed out")
#             finally:
#                 self.hub.crash()
#                 self.thread.join()
#         for key in list(sys.modules.keys()):
#             if key == 'zorro' or key.startswith('zorro.'):
#                 del sys.modules[key]
# 
# def interactive(zfun):
#     def wrapper(fun):
#         @wraps(fun)
#         def wrapping(self, *a, **kw):
#             self.hub.add_task(partial(zfun, self, *a, **kw))
#             self.thread.start()
#             fun(self, *a, **kw)
#         return wrapping
#     return wrapper


# Path: tests/test_http.py
import time
import http.server
        import zorro.http
        import zorro.http
    import unittest
from .base import Test, interactive




class RequestHandler(http.server.BaseHTTPRequestHandler):

    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-Length', '5')
        self.end_headers()
        self.wfile.write(b'HELLO')
        self.wfile.flush()

    def do_FETCH(self):
        self.send_response(200)
        self.send_header('Transfer-Encoding', 'chunked')
        self.end_headers()
        self.wfile.write(b'5\r\nHELLO\r\n0\r\n\r\n')
        self.wfile.flush()



class Simple(Test):