The accession of Valens gave a fresh lease of life to the Arian party. He issued a decree banishing the bishops who had been deposed by Constantius, but who had been permitted by Jovian to return to their sees. The news created the greatest consternation in the city of Alexandria itself, and the prefect, in order to prevent a serious outbreak, gave public assurance that the very special case of Athanasius would be laid before the emperor. But the saint seems to have divined what was preparing in secret against him. He quietly withdrew from Alexandria, 5 October, and took up his abode in a country house outside the city. Valens, who seems to have sincerely dreaded the possible consequences of another popular outbreak, within a few weeks issued orders allowing Athanasius to return to his episcopal see. 
What did  Athanasius do to protect himself?
withdrew from Alexandria, 5 October