Although the Chinese government provides free-of-charge voluntary HIV counseling and testing, HIV testing rates among men who have sex with men (MSM) are reported to be extremely low. This study examines the association of structural and psychosocial factors and social network characteristics with HIV testing behaviors among "money boys" and general MSM in Shanghai. Overall, 28.5% of "money boys" and 50.5% of general MSM had never tested for HIV despite high rates of reported HIV risk behaviors. Factors associated with not testing for HIV included: not knowing of a testing site, limited HIV knowledge, low perceived HIV risk, concern about HIV testing confidentiality, being a closeted gay, not using the Internet, and having a small social network or network with few members who had tested for HIV. Future efforts to promote HIV testing should focus on outreach to general MSM, confidentiality protection, decreasing the stigma of homosexuality, and encouraging peer education and support through the Internet and social networks.