The best advise is never to do anything that would antagonize an LEO, especially if you’re not black or Hispanic. If they do stop you, be exceedingly polite and ignore any provocation or insulting remark on the LEO’s part. Like it or not, that’s the way it is.
I don’t really have what it takes to follow that advice. During the stop in question, I was so dumbfounded by the cop’s behavior that all I could do was stammer. If the situation were repeated I’m pretty sure I would tell the cop what I think of his “disrespect” and take my chances in court (whereas I plead “nolo” last time).