diff options
author | Narayan Kamath <narayan@google.com> | 2014-12-02 17:40:18 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-02 17:40:19 +0000 |
commit | b438b395ab07eb012fc21c526053ee43d2710c25 (patch) | |
tree | 1756ed2368273dd2820ce12623260907c38a0ae4 | |
parent | 0f8e85c36650d20d9818ffda1ce87243ea829285 (diff) | |
parent | 36d3eb1a46c33860c1d74d2fa30db2be4a03ac1d (diff) | |
download | libcore-b438b395ab07eb012fc21c526053ee43d2710c25.zip libcore-b438b395ab07eb012fc21c526053ee43d2710c25.tar.gz libcore-b438b395ab07eb012fc21c526053ee43d2710c25.tar.bz2 |
Merge "Add test case for issue 18428603" into lmp-mr1-dev
-rw-r--r-- | luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java index ff055b2..95ccaaa 100644 --- a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java +++ b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java @@ -26,6 +26,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; +import java.net.SocketAddress; import java.net.SocketException; import java.net.SocketTimeoutException; import java.security.Principal; @@ -1570,6 +1571,28 @@ public class SSLSocketTest extends TestCase { } } + // http://b/18428603 + public void test_SSLSocket_getPortWithSNI() throws Exception { + TestSSLContext context = TestSSLContext.create(); + + SSLSocket client = null; + try { + client = (SSLSocket) context.clientContext.getSocketFactory().createSocket(); + client.connect(new InetSocketAddress(context.host, context.port)); + try { + // This is crucial to reproducing issue 18428603. + Method setHostname = client.getClass().getMethod("setHostname", String.class); + setHostname.invoke(client, "sslsockettest.androidcts.google.com"); + } catch (NoSuchMethodException ignored) { + } + + assertTrue(client.getPort() > 0); + } finally { + client.close(); + context.close(); + } + } + public void test_SSLSocket_sendsTlsFallbackScsv_Fallback_Success() throws Exception { TestSSLContext context = TestSSLContext.create(); |