def METHOD_NAME():
    parser = argparse.ArgumentParser(description="Run a python tornado client")
    parser.add_argument('--port', dest='port', default= '9090')
    parser.add_argument('--protocol', dest='protocol_type', default="binary", choices="binary, compact, json")
    parser.add_argument('--transport', dest='transport_type', default=NATS_NAME,
                        choices="nats, http")
    args = parser.parse_args()
    protocol_factory = get_protocol_factory(args.protocol_type)
    nats_client = NATS()
    logging.debug("Connecting to NATS")
    yield nats_client.connect(**get_nats_options())
    transport = None
    if args.transport_type == NATS_NAME:
        transport = FNatsTransport(nats_client, "frugal.foo.bar.rpc.{}".format(args.port))
    elif args.transport_type == HTTP_NAME:
        # Set request and response capacity to 1mb
        max_size = 1048576
        transport = FHttpTransport("http://localhost:" + str(args.port),
                                   request_capacity=max_size,
                                   response_capacity=max_size)
    else:
        print("Unknown transport type: {}".format(args.transport_type))
        sys.exit(1)
    try:
        yield transport.open()
    except TTransportException as ex:
        logging.error(ex)
        raise gen.Return()
    client = FrugalTestClient(FServiceProvider(transport, protocol_factory), client_middleware)
    ctx = FContext("test")
    yield test_rpc(client, ctx, args.transport_type)
    if transport == NATS_NAME:
        yield test_pub_sub(nats_client, protocol_factory, args.port)
    global middleware_called
    if not middleware_called:
        print("Client middleware never invoked")
        exit(1)
    # Cleanup after tests
    yield nats_client.close()