While masturbation is normal, how one does it may be abnormal. So dont worry about your masturbation. It may happen that when one masturbates there may be vigorous activity and this may make the testes a bit wobbly and the normal axis of the testes may get disturbed. This causes pain following masturbation.
Also if the masturbation if NOT adequately frequent, there may be a built up of sperms in the testes which can cause some local pain.
Next Steps
Pain is a part of life, if severe you can see a general surgeon. If not and if pain has gone in resting, thats the only method to relieve it.
Health Tips
Wheil you masturbate DO NOT do it in standing position, as this causes larger swaying of the testes. Try to do it in sleeping posture. Some people masturbate while lying face down on bed, this too can cause abnormal pressure on testes to make it change its position. Avoid this face down position.