(argv)
| 51 | |
| 52 | # THeader stack should accept binary protocol with optionally framed transport |
| 53 | def 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 | |
| 88 | if __name__ == '__main__': |
no test coverage detected