In certain cases, within reasonable amount of time, there are treatments that can be administered that can possibly prevent the development of HIV after exposure. I would HIGHLY advise you see a doctor immediately and request being considered for this treatment.
Whether or not your doctor will decide to treat you in this way depends on exactly when the exposure was, so please see a doctor very soon, today if possible.
This is generally a 4 week regime of several medications, it is not 100% effective in prevention.
And to answer your question, you can have an hiv test as soon as you suspect you may have had exposure, the results will be back within about 1 -2 weeks, however, a test this soon after exposure may lead to a false negative, and it is sugguested that you are re-tested to be sure this result is accurate, it can take up to 6 months to get an accurate result.
