def setUpClass(cls): # Create the HttpBin server by sending this request to the arbiter from examples.proxyserver.manage import server as pserver from examples.httpbin import manage concurrency = cls.concurrency or cls.cfg.concurrency if cls.with_httpbin: server = manage.server if cls.with_tls: base_path = os.path.abspath(os.path.dirname(manage.__file__)) key_file = os.path.join(base_path, 'server.key') cert_file = os.path.join(base_path, 'server.crt') else: key_file, cert_file = None, None s = server(bind='127.0.0.1:0', concurrency=concurrency, name='httpbin-%s' % cls.__name__.lower(), keep_alive=30, key_file=key_file, cert_file=cert_file, workers=1) cfg = yield from send('arbiter', 'run', s) cls.app = cfg.app() bits = ('https' if cls.with_tls else 'http',) + cfg.addresses[0] # bits = (bits[0], 'dynquant.com', '8070') cls.uri = '%s://%s:%s/' % bits if cls.with_proxy: s = pserver(bind='127.0.0.1:0', concurrency=concurrency, name='proxyserver-%s' % cls.__name__.lower()) cfg = yield from send('arbiter', 'run', s) cls.proxy_app = cfg.app() cls.proxy_uri = 'http://{0}:{1}'.format(*cfg.addresses[0]) # cls.proxy_uri = 'http://127.0.0.1:8080' cls._client = cls.client()
def setUpClass(cls): # Create the HttpBin server by sending this request to the arbiter from examples.proxyserver.manage import server as pserver from examples.httpbin import manage concurrency = cls.concurrency or cls.cfg.concurrency if cls.with_httpbin: server = manage.server if cls.with_tls: base_path = os.path.abspath(os.path.dirname(manage.__file__)) key_file = os.path.join(base_path, "server.key") cert_file = os.path.join(base_path, "server.crt") else: key_file, cert_file = None, None s = server( bind="127.0.0.1:0", concurrency=concurrency, name="httpbin-%s" % cls.__name__.lower(), keep_alive=30, key_file=key_file, cert_file=cert_file, workers=1, ) cfg = yield from send("arbiter", "run", s) cls.app = cfg.app() bits = ("https" if cls.with_tls else "http",) + cfg.addresses[0] cls.uri = "%s://%s:%s/" % bits if cls.with_proxy: s = pserver(bind="127.0.0.1:0", concurrency=concurrency, name="proxyserver-%s" % cls.__name__.lower()) cfg = yield from send("arbiter", "run", s) cls.proxy_app = cfg.app() cls.proxy_uri = "http://{0}:{1}".format(*cfg.addresses[0]) cls._client = cls.client()
def setUpClass(cls): # Create the HttpBin server by sending this request to the arbiter from examples.proxyserver.manage import server as pserver from examples.httpbin import manage concurrency = cls.concurrency or cls.cfg.concurrency if cls.with_httpbin: server = manage.server if cls.with_tls: base_path = os.path.abspath(os.path.dirname(manage.__file__)) key_file = os.path.join(base_path, 'server.key') cert_file = os.path.join(base_path, 'server.crt') else: key_file, cert_file = None, None s = server(bind='127.0.0.1:0', concurrency=concurrency, name='httpbin-%s' % cls.__name__.lower(), keep_alive=30, key_file=key_file, cert_file=cert_file, workers=1) cfg = yield from send('arbiter', 'run', s) cls.app = cfg.app() bits = ('https' if cls.with_tls else 'http', ) + cfg.addresses[0] # bits = (bits[0], 'dynquant.com', '8070') cls.uri = '%s://%s:%s/' % bits if cls.with_proxy: s = pserver(bind='127.0.0.1:0', concurrency=concurrency, name='proxyserver-%s' % cls.__name__.lower()) cfg = yield from send('arbiter', 'run', s) cls.proxy_app = cfg.app() cls.proxy_uri = 'http://{0}:{1}'.format(*cfg.addresses[0]) # cls.proxy_uri = 'http://127.0.0.1:8080' cls._client = cls.client()
def setUpClass(cls): # Create the HttpBin server by sending this request to the arbiter from examples.proxyserver.manage import server as pserver from examples.httpbin.manage import server concurrency = cls.cfg.concurrency s = server(bind='127.0.0.1:0', concurrency=concurrency, name='httpbin-%s' % cls.__name__.lower()) outcome = send('arbiter', 'run', s) yield outcome cls.app = outcome.result cls.uri = 'http://{0}:{1}'.format(*cls.app.address) if cls.with_proxy: s = pserver(bind='127.0.0.1:0', concurrency=concurrency, name='proxyserver-%s' % cls.__name__.lower()) outcome = send('arbiter', 'run', s) yield outcome cls.proxy_app = outcome.result cls.proxy_uri = 'http://{0}:{1}'.format(*cls.proxy_app.address)