How come my rtesticle hurts when I'm about to ejaculate?

See a doctor. Can't say without more information: does this always happen? How long has it gone on? How bad a pain? If this is a long-standing problem you should go directly to seeing a doctor.