THRIFT-2497 server and client for test/go, also several fixes and improvements
Client: Go
Patch: Aleksey Pesternikov

This closes #109

commit f2e7186ca8d63f407dba0c56ee51afd6405926ba
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-22T12:48:14Z

add _ to generated filename if it ends with _test.go

commit a6ed88196fbf4622a3b0261bbac0fe6b258bdd36
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-22T14:19:13Z

use tcxx instead of tr1 in test/cpp

commit d1848fa05f4baefc66eb405f4b1a8657bb2869bd
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-23T01:01:03Z

Merge branch 'master' of https://github.com/apache/thrift into go_integration

commit 04d22fef228d3f868b32a296a38f99ff52ee2142
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T00:34:24Z

additions:
 test for client/server with several protocol/transport/ssl combinations
 bin/testclient and bin/testserver
 debug_transport

fixes:
 separate Listen() and AcceptLoop() instead of Serve() in SimpleServer
 if handler function returns any unknown exception, handler closes connection

commit ed88d57d977cffea9fac8f61143801f3097ef46c
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T13:29:54Z

Generate lowercase package name
 lowercased pkg name in thrift files
 underline() -> lowercase()

commit 498a910c6c6753a4b1e3633eb5c9c82be33e8c7b
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T13:32:26Z

Merge branch 'master' into go_test_service_name

commit 25792d7218a2c32ee3c2077f65ca7d0cea7f31f5
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-22T12:48:14Z

add _ to generated filename if it ends with _test.go

commit af994b415308a2e174d57a03675fc83d7cbd43d1
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T00:34:24Z

additions:
 test for client/server with several protocol/transport/ssl combinations
 bin/testclient and bin/testserver
 debug_transport

fixes:
 separate Listen() and AcceptLoop() instead of Serve() in SimpleServer
 if handler function returns any unknown exception, handler closes connection

commit f22a777a5d5b4d93a8d7981e7aadc2c63919518a
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T13:44:08Z

Merge branch 'go_integration' of github.com:apesternikov/thrift into go_integration

commit 49a33c8c80ea35f923ee9aa3577780fcf41fe840
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T13:49:05Z

Merge branch 'master' into test_cpp_on_mac

commit 81b402ec6301f6b132c9b346ad5481f55f0aff89
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T13:56:56Z

operator < for ThriftTest

commit cde312d940d12077274dd0ba677ca850b5b439a7
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T14:12:58Z

minor formatting

commit 0a693115c2c20a2a8375f3859ff7bed261e6c8da
 Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
 Date: 2014-04-25T14:13:20Z

Merge branch 'test_cpp_on_mac' into go_integration

commit e06b5d24e8b6d429723a3c77a58c6ce903e1366a
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T15:19:20Z

Merge branch 'go_test_service_name' into go_integration

commit 42d577c9812a070060c773fcd0598e58e6d6ba61
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T15:39:57Z

imported THRIFT-2491
 lowercase package names

commit 491ccf8b018c046c5ced72b1e19d9ac4ec48a6f5
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T15:51:53Z

--noinsane flag for c++ TestClient. works with go server now for other default params

commit 78db3c9a3a5742818a5de6e57f2fe9aed84919e5
 Author: Aleksey Pesternikov <ap@alekseys-macbook-pro.local>
 Date: 2014-04-25T16:03:23Z

license
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 4ebbb81..7a783d2 100755
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -102,6 +102,7 @@
   string transport_type = "buffered";
   string protocol_type = "binary";
   string domain_socket = "";
+  bool noinsane = false;
 
   boost::program_options::options_description desc("Allowed options");
   desc.add_options()
@@ -113,6 +114,7 @@
       ("protocol", boost::program_options::value<string>(&protocol_type)->default_value(protocol_type), "Protocol: binary, compact, json")
 	  ("ssl", "Encrypted Transport using SSL")
       ("testloops,n", boost::program_options::value<int>(&numTests)->default_value(numTests), "Number of Tests")
+      ("noinsane", "Do not run insanity test")
   ;
 
   boost::program_options::variables_map vm;
@@ -153,6 +155,10 @@
   if (vm.count("ssl")) {
     ssl = true;
   }
+  
+  if (vm.count("noinsane")) {
+    noinsane = true;
+  }
 
   boost::shared_ptr<TTransport> transport;
   boost::shared_ptr<TProtocol> protocol;
@@ -518,52 +524,53 @@
     /**
      * INSANITY TEST
      */
-    Insanity insane;
-    insane.userMap.insert(make_pair(Numberz::FIVE, 5000));
-    Xtruct truck;
-    truck.string_thing = "Truck";
-    truck.byte_thing = 8;
-    truck.i32_thing = 8;
-    truck.i64_thing = 8;
-    insane.xtructs.push_back(truck);
-    printf("testInsanity()");
-    map<UserId, map<Numberz::type,Insanity> > whoa;
-    testClient.testInsanity(whoa, insane);
-    printf(" = {");
-    map<UserId, map<Numberz::type,Insanity> >::const_iterator i_iter;
-    for (i_iter = whoa.begin(); i_iter != whoa.end(); ++i_iter) {
-      printf("%" PRId64 " => {", i_iter->first);
-      map<Numberz::type,Insanity>::const_iterator i2_iter;
-      for (i2_iter = i_iter->second.begin();
-           i2_iter != i_iter->second.end();
-           ++i2_iter) {
-        printf("%d => {", i2_iter->first);
-        map<Numberz::type, UserId> userMap = i2_iter->second.userMap;
-        map<Numberz::type, UserId>::const_iterator um;
-        printf("{");
-        for (um = userMap.begin(); um != userMap.end(); ++um) {
-          printf("%d => %" PRId64 ", ", um->first, um->second);
-        }
-        printf("}, ");
+    if (!noinsane) {
+      Insanity insane;
+      insane.userMap.insert(make_pair(Numberz::FIVE, 5000));
+      Xtruct truck;
+      truck.string_thing = "Truck";
+      truck.byte_thing = 8;
+      truck.i32_thing = 8;
+      truck.i64_thing = 8;
+      insane.xtructs.push_back(truck);
+      printf("testInsanity()");
+      map<UserId, map<Numberz::type,Insanity> > whoa;
+      testClient.testInsanity(whoa, insane);
+      printf(" = {");
+      map<UserId, map<Numberz::type,Insanity> >::const_iterator i_iter;
+      for (i_iter = whoa.begin(); i_iter != whoa.end(); ++i_iter) {
+        printf("%" PRId64 " => {", i_iter->first);
+        map<Numberz::type,Insanity>::const_iterator i2_iter;
+        for (i2_iter = i_iter->second.begin();
+             i2_iter != i_iter->second.end();
+             ++i2_iter) {
+          printf("%d => {", i2_iter->first);
+          map<Numberz::type, UserId> userMap = i2_iter->second.userMap;
+          map<Numberz::type, UserId>::const_iterator um;
+          printf("{");
+          for (um = userMap.begin(); um != userMap.end(); ++um) {
+            printf("%d => %" PRId64 ", ", um->first, um->second);
+          }
+          printf("}, ");
 
-        vector<Xtruct> xtructs = i2_iter->second.xtructs;
-        vector<Xtruct>::const_iterator x;
-        printf("{");
-        for (x = xtructs.begin(); x != xtructs.end(); ++x) {
-          printf("{\"%s\", %d, %d, %" PRId64 "}, ",
-                 x->string_thing.c_str(),
-                 (int)x->byte_thing,
-                 x->i32_thing,
-                 x->i64_thing);
-        }
-        printf("}");
+          vector<Xtruct> xtructs = i2_iter->second.xtructs;
+          vector<Xtruct>::const_iterator x;
+          printf("{");
+          for (x = xtructs.begin(); x != xtructs.end(); ++x) {
+            printf("{\"%s\", %d, %d, %" PRId64 "}, ",
+                   x->string_thing.c_str(),
+                   (int)x->byte_thing,
+                   x->i32_thing,
+                   x->i64_thing);
+          }
+          printf("}");
 
+          printf("}, ");
+        }
         printf("}, ");
       }
-      printf("}, ");
+      printf("}\n");
     }
-    printf("}\n");
-
     /* test exception */
 
     try {