Lightly crush coffee beans with a mallet in a paper or plastic bag and mix with your whole milk. Cover and let infuse overnight until light brown.
The next day, Transfer mixture to a large stock pot and cook over medium heat until steaming.
Meanwhile, in a large pyrex bowl, whisk together sugars, salt, cornstarch, and egg yolks.
Carefully pour some of your hot milk mixture through a strainer into your egg mixture and whisk vigorously.
When the egg mixture is thin and cohesive, strain the rest of the milk into the egg mixture and whisk to combine.
In a clean stock pot, return your egg and milk mixture to the heat and turn it up to medium/high.
Whisk constantly until the mixture thickens into a thin pudding consistency. It should coat the back of a spoon.
Remove custard from heat and let cool. Strain one again through a fine-mesh strainer into a heatproof container with a lid. Once cooled, transfer to fridge to cool overnight.
The next day, prepare your ice cream machine and pour your custard into the base. Check back in 15-20 minutes to see if the custard has thickened into an ice-cream texture.
Once mixture is thickened, transfer to a metal loaf pan and cover with plastic wrap, placing a layer directly on top of the gelato.
Freeze for another 2-3 hours until the gelato is firm.
To make affogato, scoop a ball of ice cream with an ice cream scooper into a bowl or glass.
Prepare enough espresso for a shot and pour over your gelato. Eat with a spoon.