Security Warning:
To avoid the StripTLS attack vulnerability of StartTLS, code your application to not continue unless the connection is successfully upgraded to TLS.
For StripTLS attack vulnerability anatomy details please conduct a web search for "StripTLS".
There is a good article on Wikipedia titled "Opportunistic TLS". The "Weaknesses and mitigations" section details the StripTLS attack vulnerability.