Instead of getting angry, you can simply leave politely, and keep your dignity. That is, if you are absolutely sure they won't hire you. You'd have to have very clear unmistakable evidence for that.

Without such evidence, you don't know if they really won't hire you. There may be all kinds of reasons for the interviewers' behavior. He might have an unusual character, a bad day, as strange interviewing technique, etc. Taking that into account, you can rarely make a correct preemptive judgement, and without forming such a judgement, there is no reason to become angry.

<sub>Edit, from comment:</sub>
> A interviewer might say oh you have no experience with Y and we want someone with X, then [...] I put all this effort trying to learn interview question and the unfairness of the situation, make me get confrontational with the interviewer

There is nothing "unfair" in what you are describing. The purpose of the interview is to find out if you match the job, not to test how well you learned interview questions. Sometimes the interview will show that that you and the employers aren't a good match, which is normal, and no reason for angry outbursts.