The heating mechanism of electrons in the shock front of an expanding plasma