diff options
author | Narayan Kamath <narayan@google.com> | 2014-12-02 17:53:28 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-02 17:53:28 +0000 |
commit | 783d42dfa50f7eb20118fef2655fc8a7926ae670 (patch) | |
tree | e20cfa5f73a2e7d1f2ee23cc8e58d239797cb97a /luni/src | |
parent | 539f9c17daad324577f81a29d873a43750ccfc8d (diff) | |
parent | b438b395ab07eb012fc21c526053ee43d2710c25 (diff) | |
download | libcore-783d42dfa50f7eb20118fef2655fc8a7926ae670.zip libcore-783d42dfa50f7eb20118fef2655fc8a7926ae670.tar.gz libcore-783d42dfa50f7eb20118fef2655fc8a7926ae670.tar.bz2 |
am b438b395: Merge "Add test case for issue 18428603" into lmp-mr1-dev
* commit 'b438b395ab07eb012fc21c526053ee43d2710c25':
Add test case for issue 18428603
Diffstat (limited to 'luni/src')
-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 abf8c89..199164e 100644 --- a/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java +++ b/luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java @@ -28,6 +28,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; @@ -1581,6 +1582,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(); |