You don't. But given a large enough group of people, some will contract the infection "organically." So some people get a vaccine and some get a placebo and then you check back in years later and see if the vaccine group has a lower infection rate.
Phase 1 trials are for safety, not efficacy -- they don't care if the participants are infected with HIV, because they only want to make sure that the vaccine doesn't hurt them.