#NEWLINE# def test_finagle( self ) : #NEWLINE# #INDENT# queue = deque ( ) #NEWLINE# pcap_file = get_pcap_path ( 'finagle-thrift' ) #NEWLINE# handler = StreamHandler ( queue , read_values = True , finagle_thrift = True ) #NEWLINE# sniffer = Sniffer ( 'ignore' , 9090 , handler , offline = pcap_file ) #NEWLINE# sniffer . join ( ) #NEWLINE# self . assertEquals ( len ( queue ) , 22 ) #NEWLINE# ( _ , src , dst , msg ) = queue . popleft ( ) #NEWLINE# self . assertEquals ( msg . method , '__can__finagle__trace__v3__' ) #NEWLINE# self . assertEquals ( msg . type , 'call' ) #NEWLINE# self . assertEquals ( len ( msg . args ) , 0 ) #NEWLINE# ( _ , src , dst , msg ) = queue . popleft ( ) #NEWLINE# self . assertEquals ( msg . method , '__can__finagle__trace__v3__' ) #NEWLINE# self . assertEquals ( msg . type , 'reply' ) #NEWLINE# self . assertEquals ( len ( msg . args ) , 0 ) #NEWLINE# ( _ , src , dst , msg ) = queue . popleft ( ) #NEWLINE# self . assertEquals ( msg . method , 'search' ) #NEWLINE# self . assertEquals ( msg . type , 'call' ) #NEWLINE# self . assertEquals ( len ( msg . header ) , 4 ) #NEWLINE# self . assertEquals ( msg . header [ 0 ] , ThriftField ( 'i64' , 1 , ( - 8277104800942727271 ) ) ) #NEWLINE# self . assertEquals ( msg . header [ 1 ] , ThriftField ( 'i64' , 2 , ( - 8277104800942727271 ) ) ) #NEWLINE# self . assertEquals ( msg . header [ 2 ] , ThriftField ( 'i64' , 7 , 0 ) ) #NEWLINE# contexts = msg . header [ 3 ] . value #NEWLINE# self . assertEquals ( contexts [ 0 ] [ 0 ] . value , 'com.twitter.finagle.tracing.TraceContext' ) #NEWLINE# self . assertEquals ( contexts [ 1 ] [ 0 ] . value , 'com.twitter.finagle.Deadline' ) #NEWLINE# self . assertEquals ( msg . args , ThriftStruct ( [ ThriftField ( 'string' , 1 , 'foo' ) ] ) ) #NEWLINE# ( _ , src , dst , msg ) = queue . popleft ( ) #NEWLINE# self . assertEquals ( msg . method , 'search' ) #NEWLINE# self . assertEquals ( msg . type , 'reply' ) #NEWLINE# self . assertEquals ( msg . args , ThriftStruct ( [ ThriftField ( 'list' , 0 , [ 'one' , 'two' , 'three' ] ) ] ) )