Use TrustedSocketFactory for STARTTLS.

The new TrustedSocketFactory was only being used for tunnelled connections, not STARTTLS. This adds STARTTLS support, so now TLS 1.2 can be used there. I have tested IMAP and SMTP and they work just fine, but POP3 is only compile-tested (I don't use it).