THRIFT-195. python: Add a simple THttpServer


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739638 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index a7bf6d0..7abb624 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -9,7 +9,7 @@
 from thrift.transport import TTransport
 from thrift.transport import TSocket
 from thrift.protocol import TBinaryProtocol
-from thrift.server import TServer, TNonblockingServer
+from thrift.server import TServer, TNonblockingServer, THttpServer
 
 class TestHandler:
 
@@ -77,15 +77,20 @@
   def testTypedef(self, thing):
     return thing
 
+pfactory = TBinaryProtocol.TBinaryProtocolFactory()
 handler = TestHandler()
 processor = ThriftTest.Processor(handler)
-transport = TSocket.TServerSocket(9090)
-tfactory = TTransport.TBufferedTransportFactory()
-pfactory = TBinaryProtocol.TBinaryProtocolFactory()
 
-if sys.argv[1] == "TNonblockingServer":
-  server = TNonblockingServer.TNonblockingServer(processor, transport)
+if sys.argv[1] == "THttpServer":
+  server = THttpServer.THttpServer(processor, ('', 9090), pfactory)
 else:
-  ServerClass = getattr(TServer, sys.argv[1])
-  server = ServerClass(processor, transport, tfactory, pfactory)
+  transport = TSocket.TServerSocket(9090)
+  tfactory = TTransport.TBufferedTransportFactory()
+
+  if sys.argv[1] == "TNonblockingServer":
+    server = TNonblockingServer.TNonblockingServer(processor, transport)
+  else:
+    ServerClass = getattr(TServer, sys.argv[1])
+    server = ServerClass(processor, transport, tfactory, pfactory)
+
 server.serve()