'Test that replaying encrypted messages to the server invalidates them.'

def testServerReplayAttack(self):

    self.MakeClientAFF4Record()
    decoded_messages = self.ClientServerCommunicate(timestamp=1000000)
    encrypted_messages = self.cipher_text
    self.assertEqual(decoded_messages[0].auth_state, rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED)
    (decoded_messages, _, _) = self.server_communicator.DecryptMessage(encrypted_messages)
    self.assertEqual(decoded_messages[0].auth_state, rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED)
    self.ClientServerCommunicate(timestamp=(1000000 + (3700 * 1000000)))
    (decoded_messages, _, _) = self.server_communicator.DecryptMessage(encrypted_messages)
    self.assertEqual(decoded_messages[0].auth_state, rdf_flows.GrrMessage.AuthorizationState.DESYNCHRONIZED)
