From e103355d9332e2fab9d5c408e824ac8ab3b915a7 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Wed, 5 May 2010 10:18:04 -0700 Subject: [PATCH] Remove explicit SSLSocket.startHandshake When dalvik-dev merges to master, startHandshake will imply that the caller wants a fully synchronous handshake instead of using handshake cutthrough. This removes an unnecessary startHandshake from the CertificateChainValidator. core/java/android/net/http/CertificateChainValidator.java Change-Id: Ie28abd961a06b28fa780d62b0063371ef4dc1eec --- .../android/net/http/CertificateChainValidator.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/java/android/net/http/CertificateChainValidator.java b/core/java/android/net/http/CertificateChainValidator.java index c527fe4dcfdfa..c36ad380cdad4 100644 --- a/core/java/android/net/http/CertificateChainValidator.java +++ b/core/java/android/net/http/CertificateChainValidator.java @@ -80,14 +80,10 @@ class CertificateChainValidator { throws IOException { X509Certificate[] serverCertificates = null; - // start handshake, close the socket if we fail - try { - sslSocket.setUseClientMode(true); - sslSocket.startHandshake(); - } catch (IOException e) { - closeSocketThrowException( - sslSocket, e.getMessage(), - "failed to perform SSL handshake"); + // get a valid SSLSession, close the socket if we fail + SSLSession sslSession = sslSession = sslSocket.getSession(); + if (!sslSession.isValid()) { + closeSocketThrowException(sslSocket, "failed to perform SSL handshake"); } // retrieve the chain of the server peer certificates