#NEWLINE# def ClientServerCommunicate( self , timestamp = None ) : #NEWLINE# #INDENT# 'Tests the end to end encrypted communicators.' #NEWLINE# message_list = rdf_flows . MessageList ( ) #NEWLINE# for i in range ( 1 , 11 ) : #NEWLINE# #INDENT# message_list . job . Append ( session_id = rdfvalue . SessionID ( base = 'aff4:/flows' , queue = queues . FLOWS , flow_name = i ) , name = "OMG it's a string" ) #NEWLINE# #UNINDENT# result = rdf_flows . ClientCommunication ( ) #NEWLINE# timestamp = self . client_communicator . EncodeMessages ( message_list , result , timestamp = timestamp ) #NEWLINE# self . cipher_text = result . SerializeToString ( ) #NEWLINE# ( decoded_messages , source , client_timestamp ) = self . server_communicator . DecryptMessage ( self . cipher_text ) #NEWLINE# self . assertEqual ( source , self . client_communicator . common_name ) #NEWLINE# self . assertEqual ( client_timestamp , timestamp ) #NEWLINE# self . assertEqual ( len ( decoded_messages ) , 10 ) #NEWLINE# for i in range ( 1 , 11 ) : #NEWLINE# #INDENT# self . assertEqual ( decoded_messages [ ( i - 1 ) ] . session_id , rdfvalue . SessionID ( base = 'aff4:/flows' , queue = queues . FLOWS , flow_name = i ) ) #NEWLINE# #UNINDENT# return decoded_messages