It can be done. I think there's a formal panel that gives more than a simple testosterone level. The most comprehensive panel is one they use to evaluate pituitary function.
You should be able to get one ordered by any PCP, but definitely by an endocrinologist.
Make their day and be honest: "I've been a Masters competitor for years and doping all the while. I want to make sure I haven't really fouled things up". It's much more interesting than "Doc, I can't get it up any more".
__________________
Momento mori, amor fati.