'Test worker semantics'

def test_workers(self):

    with TestServer((lambda data: (data.path[0] + data.read())), worker_count=3) as server:
        self.ae(3, sum((int(w.is_alive()) for w in server.loop.pool.workers)))
        server.loop.stop()
        server.join()
        self.ae(0, sum((int(w.is_alive()) for w in server.loop.pool.workers)))
    block = Event()
    with TestServer((lambda data: block.wait()), worker_count=3, shutdown_timeout=0.1, timeout=0.01) as server:
        pool = server.loop.pool
        self.ae(3, sum((int(w.is_alive()) for w in pool.workers)))
        conn = server.connect()
        conn.request(u'GET', u'/')
        with self.assertRaises(socket.timeout):
            res = conn.getresponse()
            if (str(res.status) == str(httplib.REQUEST_TIMEOUT)):
                raise socket.timeout(u'Timeout')
            raise Exception((u'Got    unexpected    response:    code:    %s    %s    headers:    %r    data:    %r' % (res.status, res.reason, res.getheaders(), res.read())))
        self.ae(pool.busy, 1)
        server.loop.log.filter_level = server.loop.log.ERROR
        server.loop.stop()
        server.join()
        self.ae(1, sum((int(w.is_alive()) for w in pool.workers)))
