In men, erectile dysfunction can be defined as being a persistent inability to get or keep an erection that is firm enough to attain sexual satisfaction. It should not be confused with the occasional incident when this occurs, which is an experience common to the vast majority of men for various reasons. These can include having had too much alcohol to drink, being overly-anxious about a new sexual partner, or being worried about current events in your life. The issue would only be classed as Erectile Dysfunction if it keeps happening again and again. Again, an erection once attained should be hard enough and last long enough to be satisfactory. Other conditions, like premature ejaculation, may interfere in this process but these are different problems, and would be treated differently.
The association between low testosterone and ED is not entirely clear. Although these 2 processes certainly overlap in some instances, they are distinct entities. Some 2-21% of men have both hypogonadism and ED; however, it is unclear to what degree treating the former will improve erectile function.  About 35-40% of men with low testosterone see an improvement in their erections with testosterone replacement; however, almost 65% of these men see no improvement. 
Treatment. prostatitis or another acute infection affecting the genitalia can cause temporary impotence that clears up in response to antibiotics. The smooth muscle relaxant sildenafil (viagra) was introduced in 1998 as a treatment for organic impotence. Administration of testosterone may be indicated if low levels of this hormone are found in a blood sample. If impotence is organic and does not respond to other therapies, a penile prosthesis can be implanted; this is usually done surgically by a urologist. Other therapies include the use of vacuum tumescence devices and penile injection of pharmacologic agents that cause dilation.