author | asmotrak |
Wed, 16 Nov 2016 12:50:29 -0800 | |
changeset 42155 | c9b28ab5297b |
parent 41595 | jdk/test/javax/net/ssl/templates/SSLTest.java@f1213215e135 |
child 42164 | 8a725a4f3757 |
permissions | -rw-r--r-- |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
1 |
/* |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
4 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
8 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
13 |
* accompanied this code). |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
14 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
18 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
21 |
* questions. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
22 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
23 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
24 |
import java.io.FileInputStream; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
25 |
import java.io.IOException; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
26 |
import java.io.InputStream; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
27 |
import java.io.OutputStream; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
28 |
import java.net.InetSocketAddress; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
29 |
import java.net.SocketTimeoutException; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
30 |
import java.security.KeyStore; |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
31 |
import java.security.Security; |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
32 |
import java.util.concurrent.CountDownLatch; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
33 |
import java.util.concurrent.TimeUnit; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
34 |
import javax.net.ssl.SSLContext; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
35 |
import javax.net.ssl.SSLServerSocket; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
36 |
import javax.net.ssl.SSLServerSocketFactory; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
37 |
import javax.net.ssl.SSLSocket; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
38 |
import javax.net.ssl.SSLSocketFactory; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
39 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
40 |
/** |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
41 |
* This class defines a framework for JSSE tests. |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
42 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
43 |
* Please run in othervm mode. SunJSSE does not support dynamic system |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
44 |
* properties, no way to re-use system properties in samevm/agentvm mode. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
45 |
*/ |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
46 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
47 |
/* |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
48 |
* @test |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
49 |
* @bug 1234567 |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
50 |
* @summary Use this class for JSSE tests |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
51 |
* @run main/othervm SSLSocketTemplate |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
52 |
* @author Brad Wetmore |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
53 |
*/ |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
54 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
55 |
public class SSLSocketTemplate { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
56 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
57 |
public static final String TEST_SRC = System.getProperty("test.src", "."); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
58 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
59 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
60 |
* Where do we find the keystores? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
61 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
62 |
public static final String PATH_TO_STORES = "../etc"; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
63 |
public static final String KEY_STORE_FILE = "keystore"; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
64 |
public static final String TRUST_STORE_FILE = "truststore"; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
65 |
public static final String PASSWORD = "passphrase"; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
66 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
67 |
public static final int FREE_PORT = 0; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
68 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
69 |
// in seconds |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
70 |
public static final long CLIENT_SIGNAL_TIMEOUT = 30L; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
71 |
public static final long SERVER_SIGNAL_TIMEOUT = 90L; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
72 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
73 |
// in millis |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
74 |
public static final int CLIENT_TIMEOUT = 15000; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
75 |
public static final int SERVER_TIMEOUT = 30000; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
76 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
77 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
78 |
* Should we run the client or server in a separate thread? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
79 |
* Both sides can throw exceptions, but do you have a preference |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
80 |
* as to which side should be the main thread. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
81 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
82 |
private boolean separateServerThread = false; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
83 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
84 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
85 |
* What's the server port? Use any free port by default |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
86 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
87 |
private volatile int serverPort; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
88 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
89 |
private volatile Exception serverException; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
90 |
private volatile Exception clientException; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
91 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
92 |
private Thread clientThread; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
93 |
private Thread serverThread; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
94 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
95 |
private Peer serverPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
96 |
private Peer clientPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
97 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
98 |
private Application serverApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
99 |
private Application clientApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
100 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
101 |
private SSLContext context; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
102 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
103 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
104 |
* Is the server ready to serve? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
105 |
*/ |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
106 |
private final CountDownLatch serverReadyCondition = new CountDownLatch(1); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
107 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
108 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
109 |
* Is the client ready to handshake? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
110 |
*/ |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
111 |
private final CountDownLatch clientReadyCondition = new CountDownLatch(1); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
112 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
113 |
/* |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
114 |
* Is the server done? |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
115 |
*/ |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
116 |
private final CountDownLatch serverDoneCondition = new CountDownLatch(1); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
117 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
118 |
/* |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
119 |
* Is the client done? |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
120 |
*/ |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
121 |
private final CountDownLatch clientDoneCondition = new CountDownLatch(1); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
122 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
123 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
124 |
* Public API. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
125 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
126 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
127 |
public static interface Peer { |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
128 |
void run(SSLSocketTemplate test) throws Exception; |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
129 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
130 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
131 |
public static interface Application { |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
132 |
void run(SSLSocket socket, SSLSocketTemplate test) throws Exception; |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
133 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
134 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
135 |
public static void debug() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
136 |
debug("ssl"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
137 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
138 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
139 |
public static void debug(String mode) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
140 |
System.setProperty("javax.net.debug", mode); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
141 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
142 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
143 |
public static void setup(String keyFilename, String trustFilename, |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
144 |
String password) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
145 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
146 |
System.setProperty("javax.net.ssl.keyStore", keyFilename); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
147 |
System.setProperty("javax.net.ssl.keyStorePassword", password); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
148 |
System.setProperty("javax.net.ssl.trustStore", trustFilename); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
149 |
System.setProperty("javax.net.ssl.trustStorePassword", password); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
150 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
151 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
152 |
public static void setup() throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
153 |
String keyFilename = TEST_SRC + "/" + PATH_TO_STORES + "/" |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
154 |
+ KEY_STORE_FILE; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
155 |
String trustFilename = TEST_SRC + "/" + PATH_TO_STORES + "/" |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
156 |
+ TRUST_STORE_FILE; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
157 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
158 |
setup(keyFilename, trustFilename, PASSWORD); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
159 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
160 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
161 |
public static void print(String message, Throwable... errors) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
162 |
synchronized (System.out) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
163 |
System.out.println(message); |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
164 |
for (Throwable e : errors) { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
165 |
e.printStackTrace(System.out); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
166 |
} |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
167 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
168 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
169 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
170 |
public static KeyStore loadJksKeyStore(String filename, String password) |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
171 |
throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
172 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
173 |
return loadKeyStore(filename, password, "JKS"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
174 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
175 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
176 |
public static KeyStore loadKeyStore(String filename, String password, |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
177 |
String type) throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
178 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
179 |
KeyStore keystore = KeyStore.getInstance(type); |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
180 |
FileInputStream fis = new FileInputStream(filename); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
181 |
try { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
182 |
keystore.load(fis, password.toCharArray()); |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
183 |
} finally { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
184 |
fis.close(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
185 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
186 |
return keystore; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
187 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
188 |
|
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
189 |
// Try to accept a connection in 30 seconds. |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
190 |
public static SSLSocket accept(SSLServerSocket sslServerSocket) |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
191 |
throws IOException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
192 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
193 |
return accept(sslServerSocket, SERVER_TIMEOUT); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
194 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
195 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
196 |
public static SSLSocket accept(SSLServerSocket sslServerSocket, int timeout) |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
197 |
throws IOException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
198 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
199 |
try { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
200 |
sslServerSocket.setSoTimeout(timeout); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
201 |
return (SSLSocket) sslServerSocket.accept(); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
202 |
} catch (SocketTimeoutException ste) { |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
203 |
print("Warning: ", ste); |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
204 |
return null; |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
205 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
206 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
207 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
208 |
public SSLSocketTemplate setSeparateServerThread( |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
209 |
boolean separateServerThread) { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
210 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
211 |
this.separateServerThread = separateServerThread; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
212 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
213 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
214 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
215 |
public SSLSocketTemplate setServerPort(int serverPort) { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
216 |
this.serverPort = serverPort; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
217 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
218 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
219 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
220 |
public int getServerPort() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
221 |
return serverPort; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
222 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
223 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
224 |
public SSLSocketTemplate setSSLContext(SSLContext context) { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
225 |
this.context = context; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
226 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
227 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
228 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
229 |
public SSLContext getSSLContext() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
230 |
return context; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
231 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
232 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
233 |
public SSLServerSocketFactory getSSLServerSocketFactory() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
234 |
if (context != null) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
235 |
return context.getServerSocketFactory(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
236 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
237 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
238 |
return (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
239 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
240 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
241 |
public SSLSocketFactory getSSLSocketFactory() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
242 |
if (context != null) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
243 |
return context.getSocketFactory(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
244 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
245 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
246 |
return (SSLSocketFactory) SSLSocketFactory.getDefault(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
247 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
248 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
249 |
public void signalServerReady() { |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
250 |
serverReadyCondition.countDown(); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
251 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
252 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
253 |
public void signalServerDone() { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
254 |
serverDoneCondition.countDown(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
255 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
256 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
257 |
public boolean waitForClientSignal(long timeout, TimeUnit unit) |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
258 |
throws InterruptedException { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
259 |
|
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
260 |
return clientReadyCondition.await(timeout, unit); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
261 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
262 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
263 |
public boolean waitForClientSignal() throws InterruptedException { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
264 |
return waitForClientSignal(CLIENT_SIGNAL_TIMEOUT, TimeUnit.SECONDS); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
265 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
266 |
|
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
267 |
public boolean waitForClientDone(long timeout, TimeUnit unit) |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
268 |
throws InterruptedException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
269 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
270 |
return clientDoneCondition.await(timeout, unit); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
271 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
272 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
273 |
public boolean waitForClientDone() throws InterruptedException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
274 |
return waitForClientDone(CLIENT_SIGNAL_TIMEOUT, TimeUnit.SECONDS); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
275 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
276 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
277 |
public void signalClientReady() { |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
278 |
clientReadyCondition.countDown(); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
279 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
280 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
281 |
public void signalClientDone() { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
282 |
clientDoneCondition.countDown(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
283 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
284 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
285 |
public boolean waitForServerSignal(long timeout, TimeUnit unit) |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
286 |
throws InterruptedException { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
287 |
|
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
288 |
return serverReadyCondition.await(timeout, unit); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
289 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
290 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
291 |
public boolean waitForServerSignal() throws InterruptedException { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
292 |
return waitForServerSignal(SERVER_SIGNAL_TIMEOUT, TimeUnit.SECONDS); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
293 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
294 |
|
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
295 |
public boolean waitForServerDone(long timeout, TimeUnit unit) |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
296 |
throws InterruptedException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
297 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
298 |
return serverDoneCondition.await(timeout, unit); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
299 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
300 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
301 |
public boolean waitForServerDone() throws InterruptedException { |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
302 |
return waitForServerDone(SERVER_SIGNAL_TIMEOUT, TimeUnit.SECONDS); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
303 |
} |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
304 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
305 |
public SSLSocketTemplate setServerPeer(Peer serverPeer) { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
306 |
this.serverPeer = serverPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
307 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
308 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
309 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
310 |
public Peer getServerPeer() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
311 |
return serverPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
312 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
313 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
314 |
public SSLSocketTemplate setServerApplication( |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
315 |
Application serverApplication) { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
316 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
317 |
this.serverApplication = serverApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
318 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
319 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
320 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
321 |
public Application getServerApplication() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
322 |
return serverApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
323 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
324 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
325 |
public SSLSocketTemplate setClientPeer(Peer clientPeer) { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
326 |
this.clientPeer = clientPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
327 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
328 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
329 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
330 |
public Peer getClientPeer() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
331 |
return clientPeer; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
332 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
333 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
334 |
public SSLSocketTemplate setClientApplication( |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
335 |
Application clientApplication) { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
336 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
337 |
this.clientApplication = clientApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
338 |
return this; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
339 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
340 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
341 |
public Application getClientApplication() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
342 |
return clientApplication; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
343 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
344 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
345 |
public void runTest() throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
346 |
if (separateServerThread) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
347 |
startServer(true, this); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
348 |
startClient(false, this); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
349 |
serverThread.join(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
350 |
} else { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
351 |
startClient(true, this); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
352 |
startServer(false, this); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
353 |
clientThread.join(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
354 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
355 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
356 |
if (clientException != null || serverException != null) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
357 |
throw new RuntimeException("Test failed"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
358 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
359 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
360 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
361 |
public SSLSocketTemplate() { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
362 |
serverPeer = new Peer() { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
363 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
364 |
@Override |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
365 |
public void run(SSLSocketTemplate test) throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
366 |
doServerSide(test); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
367 |
} |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
368 |
}; |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
369 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
370 |
clientPeer = new Peer() { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
371 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
372 |
@Override |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
373 |
public void run(SSLSocketTemplate test) throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
374 |
doClientSide(test); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
375 |
} |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
376 |
}; |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
377 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
378 |
serverApplication = new Application() { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
379 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
380 |
@Override |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
381 |
public void run(SSLSocket socket, SSLSocketTemplate test) |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
382 |
throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
383 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
384 |
runServerApplication(socket); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
385 |
} |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
386 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
387 |
}; |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
388 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
389 |
clientApplication = new Application() { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
390 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
391 |
@Override |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
392 |
public void run(SSLSocket socket, SSLSocketTemplate test) |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
393 |
throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
394 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
395 |
runClientApplication(socket); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
396 |
} |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
397 |
}; |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
398 |
} |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
399 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
400 |
public static void main(String args[]) throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
401 |
// reset the security property to make sure that the algorithms |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
402 |
// and keys used in this test are not disabled. |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
403 |
Security.setProperty("jdk.tls.disabledAlgorithms", ""); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
404 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
405 |
// MD5 is used in this test case, don't disable MD5 algorithm. |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
406 |
Security.setProperty( |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
407 |
"jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024"); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
408 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
409 |
setup(); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
410 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
411 |
new SSLSocketTemplate().runTest(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
412 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
413 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
414 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
415 |
* Private part. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
416 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
417 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
418 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
419 |
* Define the server side of the test. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
420 |
*/ |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
421 |
private static void doServerSide(SSLSocketTemplate test) throws Exception { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
422 |
SSLServerSocket sslServerSocket; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
423 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
424 |
// kick start the server side service |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
425 |
SSLServerSocketFactory sslssf = test.getSSLServerSocketFactory(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
426 |
sslServerSocket = (SSLServerSocket)sslssf.createServerSocket(FREE_PORT); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
427 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
428 |
test.setServerPort(sslServerSocket.getLocalPort()); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
429 |
print("Server is listening on port " + test.getServerPort()); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
430 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
431 |
// Signal the client, the server is ready to accept connection. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
432 |
test.signalServerReady(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
433 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
434 |
// Try to accept a connection in 30 seconds. |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
435 |
SSLSocket sslSocket = accept(sslServerSocket); |
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
436 |
if (sslSocket == null) { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
437 |
// Ignore the test case if no connection within 30 seconds. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
438 |
print("No incoming client connection in 30 seconds. " |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
439 |
+ "Ignore in server side."); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
440 |
return; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
441 |
} |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
442 |
print("Server accepted connection"); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
443 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
444 |
// handle the connection |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
445 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
446 |
// Is it the expected client connection? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
447 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
448 |
// Naughty test cases or third party routines may try to |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
449 |
// connection to this server port unintentionally. In |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
450 |
// order to mitigate the impact of unexpected client |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
451 |
// connections and avoid intermittent failure, it should |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
452 |
// be checked that the accepted connection is really linked |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
453 |
// to the expected client. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
454 |
boolean clientIsReady = test.waitForClientSignal(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
455 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
456 |
if (clientIsReady) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
457 |
// Run the application in server side. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
458 |
print("Run server application"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
459 |
test.getServerApplication().run(sslSocket, test); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
460 |
} else { // Otherwise, ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
461 |
// We don't actually care about plain socket connections |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
462 |
// for TLS communication testing generally. Just ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
463 |
// the test if the accepted connection is not linked to |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
464 |
// the expected client or the client connection timeout |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
465 |
// in 30 seconds. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
466 |
print("The client is not the expected one or timeout. " |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
467 |
+ "Ignore in server side."); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
468 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
469 |
} finally { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
470 |
sslSocket.close(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
471 |
sslServerSocket.close(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
472 |
} |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
473 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
474 |
test.signalServerDone(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
475 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
476 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
477 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
478 |
* Define the server side application of the test for the specified socket. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
479 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
480 |
private static void runServerApplication(SSLSocket socket) |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
481 |
throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
482 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
483 |
// here comes the test logic |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
484 |
InputStream sslIS = socket.getInputStream(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
485 |
OutputStream sslOS = socket.getOutputStream(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
486 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
487 |
sslIS.read(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
488 |
sslOS.write(85); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
489 |
sslOS.flush(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
490 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
491 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
492 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
493 |
* Define the client side of the test. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
494 |
*/ |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
495 |
private static void doClientSide(SSLSocketTemplate test) throws Exception { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
496 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
497 |
// Wait for server to get started. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
498 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
499 |
// The server side takes care of the issue if the server cannot |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
500 |
// get started in 90 seconds. The client side would just ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
501 |
// the test case if the serer is not ready. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
502 |
boolean serverIsReady = test.waitForServerSignal(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
503 |
if (!serverIsReady) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
504 |
print("The server is not ready yet in 90 seconds. " |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
505 |
+ "Ignore in client side."); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
506 |
return; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
507 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
508 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
509 |
SSLSocketFactory sslsf = test.getSSLSocketFactory(); |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
510 |
SSLSocket sslSocket = (SSLSocket)sslsf.createSocket(); |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
511 |
try { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
512 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
513 |
sslSocket.connect( |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
514 |
new InetSocketAddress("localhost", |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
515 |
test.getServerPort()), CLIENT_TIMEOUT); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
516 |
print("Client connected to server"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
517 |
} catch (IOException ioe) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
518 |
// The server side may be impacted by naughty test cases or |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
519 |
// third party routines, and cannot accept connections. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
520 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
521 |
// Just ignore the test if the connection cannot be |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
522 |
// established. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
523 |
print("Cannot make a connection in 15 seconds. " |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
524 |
+ "Ignore in client side.", ioe); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
525 |
return; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
526 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
527 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
528 |
// OK, here the client and server get connected. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
529 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
530 |
// Signal the server, the client is ready to communicate. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
531 |
test.signalClientReady(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
532 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
533 |
// There is still a chance in theory that the server thread may |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
534 |
// wait client-ready timeout and then quit. The chance should |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
535 |
// be really rare so we don't consider it until it becomes a |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
536 |
// real problem. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
537 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
538 |
// Run the application in client side. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
539 |
print("Run client application"); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
540 |
test.getClientApplication().run(sslSocket, test); |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
541 |
} finally { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
542 |
sslSocket.close(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
543 |
} |
41595
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
544 |
|
f1213215e135
8166530: sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java fails intermittently
asmotrak
parents:
41196
diff
changeset
|
545 |
test.signalClientDone(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
546 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
547 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
548 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
549 |
* Define the client side application of the test for the specified socket. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
550 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
551 |
private static void runClientApplication(SSLSocket socket) |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
552 |
throws Exception { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
553 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
554 |
InputStream sslIS = socket.getInputStream(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
555 |
OutputStream sslOS = socket.getOutputStream(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
556 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
557 |
sslOS.write(280); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
558 |
sslOS.flush(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
559 |
sslIS.read(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
560 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
561 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
562 |
private void startServer(boolean newThread, SSLSocketTemplate test) |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
563 |
throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
564 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
565 |
if (newThread) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
566 |
serverThread = new Thread() { |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
567 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
568 |
@Override |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
569 |
public void run() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
570 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
571 |
serverPeer.run(test); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
572 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
573 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
574 |
* Our server thread just died. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
575 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
576 |
* Release the client, if not active already... |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
577 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
578 |
print("Server died ...", e); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
579 |
serverException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
580 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
581 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
582 |
}; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
583 |
serverThread.start(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
584 |
} else { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
585 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
586 |
serverPeer.run(test); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
587 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
588 |
print("Server failed ...", e); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
589 |
serverException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
590 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
591 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
592 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
593 |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
594 |
private void startClient(boolean newThread, SSLSocketTemplate test) |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
595 |
throws Exception { |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
596 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
597 |
if (newThread) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
598 |
clientThread = new Thread() { |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
599 |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
600 |
@Override |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
601 |
public void run() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
602 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
603 |
clientPeer.run(test); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
604 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
605 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
606 |
* Our client thread just died. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
607 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
608 |
print("Client died ...", e); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
609 |
clientException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
610 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
611 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
612 |
}; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
613 |
clientThread.start(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
614 |
} else { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
615 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
616 |
clientPeer.run(test); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
617 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
618 |
print("Client failed ...", e); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
619 |
clientException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
620 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
621 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
622 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
623 |
} |