THRIFT-3292 Integrate new Zlib transport for Go into test suite
Client: Go
Patch: Paul Magrath <paul@swiftkey.com>

This closes #580
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index c48df0e..94b5c61 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -31,7 +31,7 @@
 var host = flag.String("host", "localhost", "Host to connect")
 var port = flag.Int64("port", 9090, "Port number to connect")
 var domain_socket = flag.String("domain-socket", "", "Domain Socket (e.g. /tmp/thrifttest.thrift), instead of host and port")
-var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http")
+var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http, zlib")
 var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json")
 var ssl = flag.Bool("ssl", false, "Encrypted Transport using SSL")
 var testloops = flag.Int("testloops", 1, "Number of Tests")
diff --git a/test/go/src/bin/testserver/main.go b/test/go/src/bin/testserver/main.go
index ebcd8e5..291dff5 100644
--- a/test/go/src/bin/testserver/main.go
+++ b/test/go/src/bin/testserver/main.go
@@ -28,7 +28,7 @@
 var host = flag.String("host", "localhost", "Host to connect")
 var port = flag.Int64("port", 9090, "Port number to connect")
 var domain_socket = flag.String("domain-socket", "", "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")
-var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http")
+var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http, zlib")
 var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json")
 var ssl = flag.Bool("ssl", false, "Encrypted Transport using SSL")
 var certPath = flag.String("certPath", "keys", "Directory that contains SSL certificates")
diff --git a/test/go/src/common/client.go b/test/go/src/common/client.go
index 267273e..e55dc6d 100644
--- a/test/go/src/common/client.go
+++ b/test/go/src/common/client.go
@@ -20,6 +20,7 @@
 package common
 
 import (
+	"compress/zlib"
 	"crypto/tls"
 	"flag"
 	"fmt"
@@ -82,6 +83,11 @@
 		trans = thrift.NewTFramedTransport(trans)
 	case "buffered":
 		trans = thrift.NewTBufferedTransport(trans, 8192)
+	case "zlib":
+		trans, err = thrift.NewTZlibTransport(trans, zlib.BestCompression)
+		if err != nil {
+			return nil, err
+		}
 	case "":
 		trans = trans
 	default:
diff --git a/test/go/src/common/server.go b/test/go/src/common/server.go
index d354b32..dc380b2 100644
--- a/test/go/src/common/server.go
+++ b/test/go/src/common/server.go
@@ -20,6 +20,7 @@
 package common
 
 import (
+	"compress/zlib"
 	"crypto/tls"
 	"flag"
 	"fmt"
@@ -99,6 +100,8 @@
 		transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
 	case "buffered":
 		transportFactory = thrift.NewTBufferedTransportFactory(8192)
+	case "zlib":
+		transportFactory = thrift.NewTZlibTransportFactory(zlib.BestCompression)
 	case "":
 		transportFactory = thrift.NewTTransportFactory()
 	default: