func (p *ThriftTestHandler) TestInsanity(argument *thrifttest.Insanity) (r map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, err error) {
	hello := thrifttest.NewXtruct()
	hello.StringThing = "Hello2"
	hello.ByteThing = 2
	hello.I32Thing = 2
	hello.I64Thing = 2

	goodbye := thrifttest.NewXtruct()
	goodbye.StringThing = "Goodbye4"
	goodbye.ByteThing = 4
	goodbye.I32Thing = 4
	goodbye.I64Thing = 4

	crazy := thrifttest.NewInsanity()
	crazy.UserMap = make(map[thrifttest.Numberz]thrifttest.UserId)
	crazy.UserMap[thrifttest.Numberz_EIGHT] = 8
	crazy.UserMap[thrifttest.Numberz_FIVE] = 5
	crazy.Xtructs = []*thrifttest.Xtruct{goodbye, hello}

	first_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)
	second_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)

	first_map[thrifttest.Numberz_TWO] = crazy
	first_map[thrifttest.Numberz_THREE] = crazy

	looney := thrifttest.NewInsanity()
	second_map[thrifttest.Numberz_SIX] = looney

	var insane = make(map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity)
	insane[1] = first_map
	insane[2] = second_map

	return insane, nil
}
func (p *ThriftTestHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 thrifttest.Numberz, arg5 thrifttest.UserId) (r *thrifttest.Xtruct, err error) {
	r = thrifttest.NewXtruct()
	r.StringThing = "Hello2"
	r.ByteThing = arg0
	r.I32Thing = arg1
	r.I64Thing = arg2
	return r, nil
}
func (p *ThriftTestHandler) TestMultiException(arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
	if arg0 == "Xception" {
		x := thrifttest.NewXception()
		x.ErrorCode = 1001
		x.Message = "This is an Xception"
		return nil, x
	} else if arg0 == "Xception2" {
		x2 := thrifttest.NewXception2()
		x2.ErrorCode = 2002
		x2.StructThing = thrifttest.NewXtruct()
		x2.StructThing.StringThing = "This is an Xception2"
		return nil, x2
	}

	res := thrifttest.NewXtruct()
	res.StringThing = arg1
	return res, nil
}
func (p *ThriftTestDriver) Start() {
	client := p.client
	t := p.t

	if client.TestVoid() != nil {
		t.Fatal("TestVoid failed")
	}

	if r, err := client.TestString("Test"); r != "Test" || err != nil {
		t.Fatal("TestString with simple text failed")
	}

	if r, err := client.TestString(""); r != "" || err != nil {
		t.Fatal("TestString with empty text failed")
	}

	stringTest := "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, " +
		"Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, " +
		"Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, " +
		"বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, " +
		"Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, " +
		"Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, " +
		"Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, " +
		"Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, " +
		"Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, " +
		"Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, " +
		"Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, " +
		"ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, " +
		"Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, " +
		"Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa " +
		"Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa " +
		"Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪" +
		"Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, " +
		"Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, " +
		"Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, " +
		"Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple " +
		"English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, " +
		"Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, " +
		"Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, " +
		"Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, " +
		"Bân-lâm-gú, 粵語"

	if r, err := client.TestString(stringTest); r != stringTest || err != nil {
		t.Fatal("TestString with all languages failed")
	}

	specialCharacters := "quote: \" backslash:" +
		" backspace: \b formfeed: \f newline: \n return: \r tab: " +
		" now-all-of-them-together: '\\\b\n\r\t'" +
		" now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><" +
		" char-to-test-json-parsing: ]] \"]] \\\" }}}{ [[[ "

	if r, err := client.TestString(specialCharacters); r != specialCharacters || err != nil {
		t.Fatal("TestString with specialCharacters failed")
	}

	if r, err := client.TestByte(1); r != 1 || err != nil {
		t.Fatal("TestByte(1) failed")
	}
	if r, err := client.TestByte(0); r != 0 || err != nil {
		t.Fatal("TestByte(0) failed")
	}
	if r, err := client.TestByte(-1); r != -1 || err != nil {
		t.Fatal("TestByte(-1) failed")
	}
	if r, err := client.TestByte(-127); r != -127 || err != nil {
		t.Fatal("TestByte(-127) failed")
	}

	if r, err := client.TestI32(-1); r != -1 || err != nil {
		t.Fatal("TestI32(-1) failed")
	}
	if r, err := client.TestI32(1); r != 1 || err != nil {
		t.Fatal("TestI32(1) failed")
	}

	if r, err := client.TestI64(-5); r != -5 || err != nil {
		t.Fatal("TestI64(-5) failed")
	}
	if r, err := client.TestI64(5); r != 5 || err != nil {
		t.Fatal("TestI64(5) failed")
	}
	if r, err := client.TestI64(-34359738368); r != -34359738368 || err != nil {
		t.Fatal("TestI64(-34359738368) failed")
	}

	if r, err := client.TestDouble(-5.2098523); r != -5.2098523 || err != nil {
		t.Fatal("TestDouble(-5.2098523) failed")
	}
	if r, err := client.TestDouble(-7.012052175215044); r != -7.012052175215044 || err != nil {
		t.Fatal("TestDouble(-7.012052175215044) failed")
	}

	// TODO: add testBinary() call

	out := thrifttest.NewXtruct()
	out.StringThing = "Zero"
	out.ByteThing = 1
	out.I32Thing = -3
	out.I64Thing = 1000000
	if r, err := client.TestStruct(out); !reflect.DeepEqual(r, out) || err != nil {
		t.Fatal("TestStruct failed")
	}

	out2 := thrifttest.NewXtruct2()
	out2.ByteThing = 1
	out2.StructThing = out
	out2.I32Thing = 5
	if r, err := client.TestNest(out2); !reflect.DeepEqual(r, out2) || err != nil {
		t.Fatal("TestNest failed")
	}

	mapout := make(map[int32]int32)
	for i := int32(0); i < 5; i++ {
		mapout[i] = i - 10
	}
	if r, err := client.TestMap(mapout); !reflect.DeepEqual(r, mapout) || err != nil {
		t.Fatal("TestMap failed")
	}

	mapTestInput := map[string]string{
		"a": "123", "a b": "with spaces ", "same": "same", "0": "numeric key",
		"longValue": stringTest, stringTest: "long key",
	}
	if r, err := client.TestStringMap(mapTestInput); !reflect.DeepEqual(r, mapTestInput) || err != nil {
		t.Fatal("TestStringMap failed")
	}

	setTestInput := map[int32]struct{}{1: {}, 2: {}, 3: {}}
	if r, err := client.TestSet(setTestInput); !reflect.DeepEqual(r, setTestInput) || err != nil {
		t.Fatal("TestSet failed")
	}

	listTest := []int32{1, 2, 3}
	if r, err := client.TestList(listTest); !reflect.DeepEqual(r, listTest) || err != nil {
		t.Fatal("TestList failed")
	}

	if r, err := client.TestEnum(thrifttest.Numberz_ONE); r != thrifttest.Numberz_ONE || err != nil {
		t.Fatal("TestEnum failed")
	}

	if r, err := client.TestTypedef(69); r != 69 || err != nil {
		t.Fatal("TestTypedef failed")
	}

	mapMapTest := map[int32]map[int32]int32{
		4:  {1: 1, 2: 2, 3: 3, 4: 4},
		-4: {-4: -4, -3: -3, -2: -2, -1: -1},
	}
	if r, err := client.TestMapMap(1); !reflect.DeepEqual(r, mapMapTest) || err != nil {
		t.Fatal("TestMapMap failed")
	}

	crazyX1 := thrifttest.NewXtruct()
	crazyX1.StringThing = "Goodbye4"
	crazyX1.ByteThing = 4
	crazyX1.I32Thing = 4
	crazyX1.I64Thing = 4

	crazyX2 := thrifttest.NewXtruct()
	crazyX2.StringThing = "Hello2"
	crazyX2.ByteThing = 2
	crazyX2.I32Thing = 2
	crazyX2.I64Thing = 2

	crazy := thrifttest.NewInsanity()
	crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId{5: 5, 8: 8}
	crazy.Xtructs = []*thrifttest.Xtruct{crazyX1, crazyX2}

	crazyEmpty := thrifttest.NewInsanity()
	crazyEmpty.UserMap = map[thrifttest.Numberz]thrifttest.UserId{}
	crazyEmpty.Xtructs = []*thrifttest.Xtruct{}

	insanity := map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity{
		1: {thrifttest.Numberz_TWO: crazy, thrifttest.Numberz_THREE: crazy},
		2: {thrifttest.Numberz_SIX: crazyEmpty},
	}
	if r, err := client.TestInsanity(crazy); !reflect.DeepEqual(r, insanity) || err != nil {
		t.Fatal("TestInsanity failed")
	}

	if err := client.TestException("TException"); err == nil {
		t.Fatal("TestException TException failed")
	}

	if err, ok := client.TestException("Xception").(*thrifttest.Xception); ok == false || err == nil {
		t.Fatal("TestException Xception failed")
	} else if err.ErrorCode != 1001 || err.Message != "Xception" {
		t.Fatal("TestException Xception failed")
	}

	if err := client.TestException("no Exception"); err != nil {
		t.Fatal("TestException no Exception failed")
	}

	if err := client.TestOneway(0); err != nil {
		t.Fatal("TestOneway failed")
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := thrifttest.NewThriftTestClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "testVoid":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "TestVoid requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.TestVoid())
		fmt.Print("\n")
		break
	case "testString":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestString requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.TestString(value0))
		fmt.Print("\n")
		break
	case "testBool":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestBool requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1) == "true"
		value0 := argvalue0
		fmt.Print(client.TestBool(value0))
		fmt.Print("\n")
		break
	case "testByte":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestByte requires 1 args")
			flag.Usage()
		}
		tmp0, err100 := (strconv.Atoi(flag.Arg(1)))
		if err100 != nil {
			Usage()
			return
		}
		argvalue0 := byte(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestByte(value0))
		fmt.Print("\n")
		break
	case "testI32":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestI32 requires 1 args")
			flag.Usage()
		}
		tmp0, err101 := (strconv.Atoi(flag.Arg(1)))
		if err101 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestI32(value0))
		fmt.Print("\n")
		break
	case "testI64":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestI64 requires 1 args")
			flag.Usage()
		}
		argvalue0, err102 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err102 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestI64(value0))
		fmt.Print("\n")
		break
	case "testDouble":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestDouble requires 1 args")
			flag.Usage()
		}
		argvalue0, err103 := (strconv.ParseFloat(flag.Arg(1), 64))
		if err103 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestDouble(value0))
		fmt.Print("\n")
		break
	case "testBinary":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestBinary requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := argvalue0
		fmt.Print(client.TestBinary(value0))
		fmt.Print("\n")
		break
	case "testStruct":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestStruct requires 1 args")
			flag.Usage()
		}
		arg105 := flag.Arg(1)
		mbTrans106 := thrift.NewTMemoryBufferLen(len(arg105))
		defer mbTrans106.Close()
		_, err107 := mbTrans106.WriteString(arg105)
		if err107 != nil {
			Usage()
			return
		}
		factory108 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt109 := factory108.GetProtocol(mbTrans106)
		argvalue0 := thrifttest.NewXtruct()
		err110 := argvalue0.Read(jsProt109)
		if err110 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestStruct(value0))
		fmt.Print("\n")
		break
	case "testNest":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestNest requires 1 args")
			flag.Usage()
		}
		arg111 := flag.Arg(1)
		mbTrans112 := thrift.NewTMemoryBufferLen(len(arg111))
		defer mbTrans112.Close()
		_, err113 := mbTrans112.WriteString(arg111)
		if err113 != nil {
			Usage()
			return
		}
		factory114 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt115 := factory114.GetProtocol(mbTrans112)
		argvalue0 := thrifttest.NewXtruct2()
		err116 := argvalue0.Read(jsProt115)
		if err116 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestNest(value0))
		fmt.Print("\n")
		break
	case "testMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestMap requires 1 args")
			flag.Usage()
		}
		arg117 := flag.Arg(1)
		mbTrans118 := thrift.NewTMemoryBufferLen(len(arg117))
		defer mbTrans118.Close()
		_, err119 := mbTrans118.WriteString(arg117)
		if err119 != nil {
			Usage()
			return
		}
		factory120 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt121 := factory120.GetProtocol(mbTrans118)
		containerStruct0 := thrifttest.NewThriftTestTestMapArgs()
		err122 := containerStruct0.ReadField1(jsProt121)
		if err122 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestMap(value0))
		fmt.Print("\n")
		break
	case "testStringMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestStringMap requires 1 args")
			flag.Usage()
		}
		arg123 := flag.Arg(1)
		mbTrans124 := thrift.NewTMemoryBufferLen(len(arg123))
		defer mbTrans124.Close()
		_, err125 := mbTrans124.WriteString(arg123)
		if err125 != nil {
			Usage()
			return
		}
		factory126 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt127 := factory126.GetProtocol(mbTrans124)
		containerStruct0 := thrifttest.NewThriftTestTestStringMapArgs()
		err128 := containerStruct0.ReadField1(jsProt127)
		if err128 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestStringMap(value0))
		fmt.Print("\n")
		break
	case "testSet":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestSet requires 1 args")
			flag.Usage()
		}
		arg129 := flag.Arg(1)
		mbTrans130 := thrift.NewTMemoryBufferLen(len(arg129))
		defer mbTrans130.Close()
		_, err131 := mbTrans130.WriteString(arg129)
		if err131 != nil {
			Usage()
			return
		}
		factory132 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt133 := factory132.GetProtocol(mbTrans130)
		containerStruct0 := thrifttest.NewThriftTestTestSetArgs()
		err134 := containerStruct0.ReadField1(jsProt133)
		if err134 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestSet(value0))
		fmt.Print("\n")
		break
	case "testList":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestList requires 1 args")
			flag.Usage()
		}
		arg135 := flag.Arg(1)
		mbTrans136 := thrift.NewTMemoryBufferLen(len(arg135))
		defer mbTrans136.Close()
		_, err137 := mbTrans136.WriteString(arg135)
		if err137 != nil {
			Usage()
			return
		}
		factory138 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt139 := factory138.GetProtocol(mbTrans136)
		containerStruct0 := thrifttest.NewThriftTestTestListArgs()
		err140 := containerStruct0.ReadField1(jsProt139)
		if err140 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestList(value0))
		fmt.Print("\n")
		break
	case "testEnum":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestEnum requires 1 args")
			flag.Usage()
		}
		tmp0, err := (strconv.Atoi(flag.Arg(1)))
		if err != nil {
			Usage()
			return
		}
		argvalue0 := thrifttest.Numberz(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestEnum(value0))
		fmt.Print("\n")
		break
	case "testTypedef":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestTypedef requires 1 args")
			flag.Usage()
		}
		argvalue0, err141 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err141 != nil {
			Usage()
			return
		}
		value0 := thrifttest.UserId(argvalue0)
		fmt.Print(client.TestTypedef(value0))
		fmt.Print("\n")
		break
	case "testMapMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestMapMap requires 1 args")
			flag.Usage()
		}
		tmp0, err142 := (strconv.Atoi(flag.Arg(1)))
		if err142 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestMapMap(value0))
		fmt.Print("\n")
		break
	case "testInsanity":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestInsanity requires 1 args")
			flag.Usage()
		}
		arg143 := flag.Arg(1)
		mbTrans144 := thrift.NewTMemoryBufferLen(len(arg143))
		defer mbTrans144.Close()
		_, err145 := mbTrans144.WriteString(arg143)
		if err145 != nil {
			Usage()
			return
		}
		factory146 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt147 := factory146.GetProtocol(mbTrans144)
		argvalue0 := thrifttest.NewInsanity()
		err148 := argvalue0.Read(jsProt147)
		if err148 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestInsanity(value0))
		fmt.Print("\n")
		break
	case "testMulti":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "TestMulti requires 6 args")
			flag.Usage()
		}
		tmp0, err149 := (strconv.Atoi(flag.Arg(1)))
		if err149 != nil {
			Usage()
			return
		}
		argvalue0 := byte(tmp0)
		value0 := argvalue0
		tmp1, err150 := (strconv.Atoi(flag.Arg(2)))
		if err150 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		argvalue2, err151 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err151 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg152 := flag.Arg(4)
		mbTrans153 := thrift.NewTMemoryBufferLen(len(arg152))
		defer mbTrans153.Close()
		_, err154 := mbTrans153.WriteString(arg152)
		if err154 != nil {
			Usage()
			return
		}
		factory155 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt156 := factory155.GetProtocol(mbTrans153)
		containerStruct3 := thrifttest.NewThriftTestTestMultiArgs()
		err157 := containerStruct3.ReadField4(jsProt156)
		if err157 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Arg3
		value3 := argvalue3
		tmp4, err := (strconv.Atoi(flag.Arg(5)))
		if err != nil {
			Usage()
			return
		}
		argvalue4 := thrifttest.Numberz(tmp4)
		value4 := argvalue4
		argvalue5, err158 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err158 != nil {
			Usage()
			return
		}
		value5 := thrifttest.UserId(argvalue5)
		fmt.Print(client.TestMulti(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "testException":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestException requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.TestException(value0))
		fmt.Print("\n")
		break
	case "testMultiException":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "TestMultiException requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.TestMultiException(value0, value1))
		fmt.Print("\n")
		break
	case "testOneway":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestOneway requires 1 args")
			flag.Usage()
		}
		tmp0, err162 := (strconv.Atoi(flag.Arg(1)))
		if err162 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestOneway(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}