Thanks for your query.Based on the facts that you have posted it appears that your pain in Rt Testicle which gets relieved on ejaculation ,It is very difficult to conclude only on limited information that you have provided and final diagnosis can be confirmed only on clinical examination .Apparently it looks like to be Prostatitis
.Please get following investigations done to confirm the diagnosis.
1) Routine Urine Test.
Scanning of the abdomen
3)Colour Doppler study of the scrotum
After getting the results of these tests which are normally available in 4-5 hours consult some Urologist
for clinical examination and proper evaluation .In the mean while take some Antibiotics like Doxycycline along with Anti inflammatory drug like Diclofenac
Twice daily .Get prescription of these drugs from your family Physician.