I personally have been in several racist situations myself. The important thing is not to react and thus stoop to the same level as the racist, but to communicate in a cool manner that forces the racist to reflect on what they said and why. If only one person is involved, I w'd approach them and coolly confront them with "May I know what I said or did or acted that invited this aggressive reaction from you?" and if this doesn't work then "May God bless you too!" and walk away. In a group situation, your foremost consern should be for your safety and peace. Yes, in self-defense, you have a lot of rope as long as you do not create a situation much worse than what you were confronted with. So, don't use self-defense as an opportunity.