Start handshake before calling hostname verifier

If the hostname verifier calls SSLSocket#getSession() before the
handshake has been started, it will implicitly start the handshake.
However, it will swallow any errors and return the canonical invalid
SSLSession instead. This makes it extremely difficult to debug issues.

Instead start the handshake before calling into the verifier since we
are guaranteed to be the first caller of #startHandshake() and won't
cause a renegotiation. That will allow us to see the actual
SSLHandshakeException if it occurs.

Bug: 14975169
Bug: 17332309
Bug: 17524215
Bug: 17812533
Bug: 18507278
Bug: 19069992
Bug: 19378885
Bug: 19414083
Bug: 19550311
Bug: 19731556
Bug: 19853723
Bug: 20908941
Change-Id: Ie74ec12c8b131c7bf400a07fc91c78da4d5e470f
1 file changed
tree: 55b480d27186e1f24c3f3c6c5c775a1eb60c67c9
  1. src/
  2. CleanSpec.mk
  3. MODULE_LICENSE_APACHE2
  4. NOTICE