Beijing has threatened to retaliate with ‘all necessary measures’ if the US hits it with sanctions