It is part of a program launched by the Chinese Association of STD and HIV/AIDS Prevention and Control to address HIV transmission on campus.
Nine such vending machines had been installed in five universities across the country by the end of 2016, the association says.
The machine is designed with a deposit drawer, but looks just like any other and, alongside the kits, sells snacks, cup noodle, and drinks, Xinhua reporters saw.
A kit is sold at a discounted price of 30 yuan (4.38 U.S. dollars), compared to 286 yuan on the market.
Zhao Donghui, an HIV specialist with the Heilongjiang Provincial Center for Disease Control and Prevention (CDC), explained the procedure: a test-taker buys the kit, collects his urine sample, and drops it back to the deposit drawer.
Staff at the provincial CDC will be notified by a sensor wired to the drawer. They come to retrieve the sample, do the testing, and post it online, he added.
Only the test taker can view the results once they log on the center's website and enter a specific code number, Zhao said.
"The whole process is anonymous," he said.
China had 654,000 people living with HIV/AIDS (PLWHA) at the end of September 2016, according to figures revealed by the China CDC.
Sexual transmission accounted for 94 percent of the 96,000 new cases reported in the nine months last year, it said. Young students and retirees are found to be the two groups where infection rose most rapidly.
There were 2,321 students aged between 15 to 24 tested positive, more than four times the figure in 2010, it added.
Wu Zunyou, head of the AIDS and HIV prevention under China CDC, said the rise of new HIV cases on campus, especially among young men, should sound a warning.
"I interviewed 100 HIV positive students and was saddened to learn that they did not know enough to protect themselves," Wu said.
Health specialists said intervention among this high-risk group was difficult due to the taboo surrounding homosexuality and HIV/AIDS.
A student who revealed his homosexuality to Xinhua said he and his boyfriend plan to use the machine. He said he has been so cautious that he goes to the local CDC to get tested every three months.
"It is all about health and there is nothing to be shy about," said the student, who chose to remain anonymous.
But many on campus do not have such an open attitude toward testing.
Peng Tao, an official with Harbin Medical University, said many students may still be reticent to take the test.
A vending machine was installed in Harbin University of Science and Technology last November, but sadly less than ten students have taken the test, said Zhao, the provincial CDC official.
Peng said as infection rises, the school has a responsibility to help those who want to try to use the machine.
It was as important as sex education in class, he said.
Nigerian exchange student Akinkunmi Okekunli said it is a right thing to do that students should have the means to know their health status.
He said in the University of Ibadan, where he came from, free testing and counseling are also available.
Health authorities said more Chinese living with HIV/AIDS know their status through testing.
The number of HIV tests people took in China grew from 60 million in 2010 to 140 million in 2015.
"We can't eliminate the virus for now, but at least we can prevent it from spreading," said Wang Mengjiao, a third-year student of Harbin Medical University. "For that purpose, it is important to take part in voluntary testing."