blob: 4b571c7a76b95a97757ad4318d0d1c1cc3dd89f2 [file] [log] [blame]
Mark Sleec9676562006-09-05 17:34:52 +00001#!/usr/bin/python
2
3import sys
4sys.path.append('./gen-py')
5
6import ThriftTest
7from ThriftTest_types import *
8from thrift.transport import TSocket
9from thrift.protocol import TBinaryProtocol
10from thrift.server import TServer
11
12class TestHandler:
13
14 def testVoid(self):
15 print 'testVoid()'
16
17 def testString(self, str):
18 print 'testString(%s)' % str
19 return str
20
21 def testByte(self, byte):
22 print 'testByte(%d)' % byte
23 return byte
24
25 def testException(self, str):
26 print 'testException(%s)' % str
27 x = Xception()
28 x.errorCode = 1001
29 x.message = str
30 raise x
31
32transport = TSocket.TServerSocket(9090)
33protocol = TBinaryProtocol.TBinaryProtocol()
34handler = TestHandler()
35iface = ThriftTest.Server(handler, protocol)
36server = TServer.TSimpleServer(iface, transport)
37server.run()