THRIFT-67. python: Add TNonblockingServer

This TNonblockingServer is very similar to the C++ implementation.
It assumes the framed transport, but it uses select instead of libevent.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@712306 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index 0247bc2..a7bf6d0 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
+from thrift.server import TServer, TNonblockingServer
 
 class TestHandler:
 
@@ -59,13 +59,33 @@
     time.sleep(seconds)
     print 'done sleeping'
 
+  def testNest(self, thing):
+    return thing
+
+  def testMap(self, thing):
+    return thing
+
+  def testSet(self, thing):
+    return thing
+
+  def testList(self, thing):
+    return thing
+
+  def testEnum(self, thing):
+    return thing
+
+  def testTypedef(self, thing):
+    return thing
+
 handler = TestHandler()
 processor = ThriftTest.Processor(handler)
 transport = TSocket.TServerSocket(9090)
 tfactory = TTransport.TBufferedTransportFactory()
 pfactory = TBinaryProtocol.TBinaryProtocolFactory()
 
-ServerClass = getattr(TServer, sys.argv[1])
-
-server = ServerClass(processor, transport, tfactory, pfactory)
+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()