Reflection and refraction of hydromagnetic waves at the magnetopause