can be due to many reasons like infection,torsion etc.
Testis is attached to spermatic cord
which enters the abdomen through a canal called inguinal canal
in groin.So,pain from the testis will radiate to the abdomen.
Please get a colour doppler of your scrotum
and confirm the diagnosis.
Till then,please take Antibiotic like Doxycycline,anti inflammatory drug
Wish you good health