Mesoscopic Josephson junctions with switchable current-phase relation