Hi and thanks for your query,
being treated for epididimytis, if well treated would not actually explain the origin of the pain. Excessive masturbation
could however aggravate the pain , or in some cases stimulate a partial testicular torsion
in some cases.
Suggest you meet the urologost again for a proper infectious and vascular work up. Doing a doppler ultrasound
of testicular vessels .
thanks and best regards