author | rhalade |
Wed, 22 Jul 2015 11:08:35 +0300 | |
changeset 31818 | 9bed5f752a87 |
parent 30820 | 0d4717a011d3 |
child 35301 | 12dabfdd1997 |
permissions | -rw-r--r-- |
26337
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
1 |
/** |
31818
9bed5f752a87
8130031: Remove the intermittent keyword for this test
rhalade
parents:
30820
diff
changeset
|
2 |
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
26337
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
4 |
* |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it under |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
6 |
* the terms of the GNU General Public License version 2 only, as published by |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
7 |
* the Free Software Foundation. |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
8 |
* |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT ANY |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
11 |
* A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
12 |
* details (a copy is included in the LICENSE file that accompanied this code). |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
13 |
* |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License version 2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
15 |
* along with this work; if not, write to the Free Software Foundation, Inc., 51 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
16 |
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
17 |
* |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
19 |
* visit www.oracle.com if you need additional information or have any |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
20 |
* questions. |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
21 |
*/ |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
22 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
23 |
import static java.lang.System.out; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
24 |
import java.security.Provider; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
25 |
import java.security.Security; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
26 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
27 |
/** |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
28 |
* @test |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
29 |
* @bug 8049429 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
30 |
* @library ../../../../lib/testlibrary/ |
30820 | 31 |
* @modules java.management |
32 |
* jdk.crypto.ec/sun.security.ec |
|
26337
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
33 |
* @build jdk.testlibrary.Utils |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
34 |
* @compile CipherTestUtils.java JSSEClient.java JSSEServer.java |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
35 |
* @summary Test that all cipher suites work in all versions and all client |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
36 |
* authentication types. The way this is setup the server is stateless and |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
37 |
* all checking is done on the client side. |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
38 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv3 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
39 |
* -DCLIENT_PROTOCOL=SSLv3 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
40 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
41 |
* @run main/othervm -DSERVER_PROTOCOL=TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
42 |
* -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
43 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
44 |
* @run main/othervm -DSERVER_PROTOCOL=TLSv1.1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
45 |
* -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
46 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
47 |
* @run main/othervm -DSERVER_PROTOCOL=TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
48 |
* -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
49 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
50 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
51 |
* -DCLIENT_PROTOCOL=TLSv1 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
52 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
53 |
* -DCLIENT_PROTOCOL=TLSv1.1 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
54 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv3 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
55 |
* -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
56 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
57 |
* TestJSSE javax.net.ssl.SSLHandshakeException |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
58 |
* @run main/othervm -DSERVER_PROTOCOL=TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
59 |
* -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
60 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
61 |
* TestJSSE javax.net.ssl.SSLHandshakeException |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
62 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
63 |
* -DCLIENT_PROTOCOL=TLSv1.2 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
64 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
65 |
* -DCLIENT_PROTOCOL=DEFAULT -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
66 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
67 |
* -DCLIENT_PROTOCOL=DEFAULT -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
68 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
69 |
* -DCLIENT_PROTOCOL=DEFAULT -Djdk.tls.client.protocols=TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
70 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
71 |
* @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
72 |
* -DCLIENT_PROTOCOL=DEFAULT -Djdk.tls.client.protocols=TLSv1.2 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
73 |
* -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
74 |
* TestJSSE javax.net.ssl.SSLHandshakeException |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
75 |
* |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
76 |
*/ |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
77 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
78 |
public class TestJSSE { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
79 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
80 |
private static final String LOCAL_IP = "127.0.0.1"; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
81 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
82 |
public static void main(String... args) throws Exception { |
28555 | 83 |
// reset the security property to make sure that the algorithms |
84 |
// and keys used in this test are not disabled. |
|
85 |
Security.setProperty("jdk.tls.disabledAlgorithms", ""); |
|
86 |
||
26337
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
87 |
String serverProtocol = System.getProperty("SERVER_PROTOCOL"); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
88 |
String clientProtocol = System.getProperty("CLIENT_PROTOCOL"); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
89 |
int port = jdk.testlibrary.Utils.getFreePort(); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
90 |
String cipher = System.getProperty("CIPHER"); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
91 |
if (serverProtocol == null |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
92 |
|| clientProtocol == null |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
93 |
|| cipher == null) { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
94 |
throw new IllegalArgumentException("SERVER_PROTOCOL " |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
95 |
+ "or CLIENT_PROTOCOL or CIPHER is missing"); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
96 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
97 |
out.println("ServerProtocol =" + serverProtocol); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
98 |
out.println("ClientProtocol =" + clientProtocol); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
99 |
out.println("Cipher =" + cipher); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
100 |
server(serverProtocol, cipher, port, args); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
101 |
client(port, clientProtocol, cipher, args); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
102 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
103 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
104 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
105 |
public static void client(int testPort, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
106 |
String testProtocols, String testCipher, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
107 |
String... exception) throws Exception { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
108 |
String expectedException = exception.length >= 1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
109 |
? exception[0] : null; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
110 |
out.println("========================================="); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
111 |
out.println(" Testing - https://" + LOCAL_IP + ":" + testPort); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
112 |
out.println(" Testing - Protocol : " + testProtocols); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
113 |
out.println(" Testing - Cipher : " + testCipher); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
114 |
Provider p = new sun.security.ec.SunEC(); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
115 |
Security.insertProviderAt(p, 1); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
116 |
try { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
117 |
CipherTestUtils.main(new JSSEFactory(LOCAL_IP, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
118 |
testPort, testProtocols, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
119 |
testCipher, "client JSSE"), |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
120 |
"client", expectedException); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
121 |
} catch (Exception e) { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
122 |
throw new RuntimeException(e); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
123 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
124 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
125 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
126 |
public static void server(String testProtocol, String testCipher, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
127 |
int testPort, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
128 |
String... exception) throws Exception { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
129 |
String expectedException = exception.length >= 1 |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
130 |
? exception[0] : null; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
131 |
out.println(" This is Server"); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
132 |
out.println(" Testing Protocol: " + testProtocol); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
133 |
out.println(" Testing Cipher: " + testCipher); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
134 |
out.println(" Testing Port: " + testPort); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
135 |
Provider p = new sun.security.ec.SunEC(); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
136 |
Security.insertProviderAt(p, 1); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
137 |
try { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
138 |
CipherTestUtils.main(new JSSEFactory(null, testPort, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
139 |
testProtocol, testCipher, "Server JSSE"), |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
140 |
"Server", expectedException); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
141 |
} catch (Exception e) { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
142 |
throw new RuntimeException(e); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
143 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
144 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
145 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
146 |
private static class JSSEFactory extends CipherTestUtils.PeerFactory { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
147 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
148 |
final String testedCipherSuite, testedProtocol, testHost; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
149 |
final int testPort; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
150 |
final String name; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
151 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
152 |
JSSEFactory(String testHost, int testPort, String testedProtocol, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
153 |
String testedCipherSuite, String name) { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
154 |
this.testedCipherSuite = testedCipherSuite; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
155 |
this.testedProtocol = testedProtocol; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
156 |
this.testHost = testHost; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
157 |
this.testPort = testPort; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
158 |
this.name = name; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
159 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
160 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
161 |
@Override |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
162 |
String getName() { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
163 |
return name; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
164 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
165 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
166 |
@Override |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
167 |
String getTestedCipher() { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
168 |
return testedCipherSuite; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
169 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
170 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
171 |
@Override |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
172 |
String getTestedProtocol() { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
173 |
return testedProtocol; |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
174 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
175 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
176 |
@Override |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
177 |
CipherTestUtils.Client newClient(CipherTestUtils cipherTest) |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
178 |
throws Exception { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
179 |
return new JSSEClient(cipherTest, testHost, testPort, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
180 |
testedProtocol, testedCipherSuite); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
181 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
182 |
|
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
183 |
@Override |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
184 |
CipherTestUtils.Server newServer(CipherTestUtils cipherTest) |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
185 |
throws Exception { |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
186 |
return new JSSEServer(cipherTest, testPort, |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
187 |
testedProtocol, testedCipherSuite); |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
188 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
189 |
} |
39f3ee5364e5
8049429: Tests for java client server communications with various TLS/SSL combinations.
xuelei
parents:
diff
changeset
|
190 |
} |