Harry and Hermione had exchanged letters through the summer as cover, through owls like they had already planned, Snape was rather surprised with how far ahead they thought, they spent the last part of their year taking lessons from Snape and using an unlicensed Time-turner (Hermione was checked at the end of the year) how he got it, they were unsure, but it proved to be helpful. They were able to deflect a Legilimens to safe and fake memories, emotions and thoughts. They were far from perfect at it, and if anyone thought better it would only take a couple well placed nudges to break their walls down, but it would do for now.