def ClientServerCommunicate(self, timestamp=None):
    message_list = rdf_flows.MessageList()
    for i in range(1, 11):
      message_list.job.Append(
          session_id=rdfvalue.SessionID(base="aff4:/flows",
                                        queue=queues.FLOWS,
                                        flow_name=i),
          name="OMG it's a string")

    result = rdf_flows.ClientCommunication()
    timestamp = self.client_communicator.EncodeMessages(message_list, result,
                                                        timestamp=timestamp)
    self.cipher_text = result.SerializeToString()

    (decoded_messages, source, client_timestamp) = (
        self.server_communicator.DecryptMessage(self.cipher_text))

    self.assertEqual(source, self.client_communicator.common_name)
    self.assertEqual(client_timestamp, timestamp)
    self.assertEqual(len(decoded_messages), 10)
    for i in range(1, 11):
      self.assertEqual(decoded_messages[i-1].session_id,
                       rdfvalue.SessionID(base="aff4:/flows",
                                          queue=queues.FLOWS,
                                          flow_name=i))

    return decoded_messages
Tests the end to end encrypted communicators.
dataset/ETHPy150Open google/grr/grr/lib/communicator_test.py/ClientCommsTest.ClientServerCommunicate