MCPcopy Create free account
hub / github.com/apache/thrift / main

Function main

test/features/theader_binary.py:53–85  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

51
52# THeader stack should accept binary protocol with optionally framed transport
53def main(argv):
54 p = argparse.ArgumentParser()
55 add_common_args(p)
56 # Since THeaderTransport acts as framed transport when detected frame, we
57 # cannot use --transport=framed as it would result in 2 layered frames.
58 p.add_argument('--override-transport')
59 p.add_argument('--override-protocol')
60 args = p.parse_args()
61 assert args.protocol == 'header'
62 assert args.transport == 'buffered'
63 assert not args.ssl
64
65 sock = TSocket(args.host, args.port, socket_family=socket.AF_INET)
66 if not args.override_transport or args.override_transport == 'buffered':
67 trans = TBufferedTransport(sock)
68 elif args.override_transport == 'framed':
69 print('TFRAMED')
70 trans = TFramedTransport(sock)
71 else:
72 raise ValueError('invalid transport')
73 trans.open()
74
75 if not args.override_protocol or args.override_protocol == 'binary':
76 proto = TBinaryProtocol(trans)
77 elif args.override_protocol == 'compact':
78 proto = TCompactProtocol(trans)
79 else:
80 raise ValueError('invalid transport')
81
82 test_void(proto)
83 test_void(proto)
84
85 trans.close()
86
87
88if __name__ == '__main__':

Callers 1

theader_binary.pyFile · 0.70

Calls 9

openMethod · 0.95
closeMethod · 0.95
add_common_argsFunction · 0.90
TSocketClass · 0.90
TBufferedTransportClass · 0.90
TFramedTransportClass · 0.90
TBinaryProtocolClass · 0.90
TCompactProtocolClass · 0.90
test_voidFunction · 0.85

Tested by

no test coverage detected