1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
120 boolean supportsSNIOnServer
121 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_SERVER);
122 boolean supportsSNIOnClient
123 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_CLIENT);
124 boolean supportsALPNOnServer
125 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_SERVER);
126 boolean supportsALPNOnClient
127 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_CLIENT);
128 boolean negativeCase
129 = Utils.getBoolProperty(Utils.PROP_NEGATIVE_CASE_ON_CLIENT);
130 System.out.println(Utils.join(Utils.PARAM_DELIMITER,
131 "ClientJDK=" + System.getProperty(Utils.PROP_CLIENT_JDK),
132 "Protocol=" + protocol,
133 "CipherSuite=" + cipherSuite,
134 "ServerName=" + serverName,
135 "AppProtocols=" + appProtocols));
136
137 Status status = Status.SUCCESS;
138 Client client = null;
139 try {
140 client = new Client(Cert.getCerts(cipherSuite));
141 client.setEnabledProtocols(protocol);
142 client.setEnabledCipherSuites(cipherSuite);
143
144 if (serverName != null) {
145 if (supportsSNIOnClient) {
146 client.setServerName(serverName);
147 } else {
148 System.out.println(
149 "Ignored due to client doesn't support SNI.");
150 }
151 }
152
153 if (appProtocols != null) {
154 if (supportsALPNOnClient) {
155 client.setApplicationProtocols(
156 Utils.split(appProtocols, Utils.VALUE_DELIMITER));
157 } else {
158 System.out.println(
159 "Ignored due to client doesn't support ALPN.");
160 }
|
1 /*
2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
120 boolean supportsSNIOnServer
121 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_SERVER);
122 boolean supportsSNIOnClient
123 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_CLIENT);
124 boolean supportsALPNOnServer
125 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_SERVER);
126 boolean supportsALPNOnClient
127 = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_CLIENT);
128 boolean negativeCase
129 = Utils.getBoolProperty(Utils.PROP_NEGATIVE_CASE_ON_CLIENT);
130 System.out.println(Utils.join(Utils.PARAM_DELIMITER,
131 "ClientJDK=" + System.getProperty(Utils.PROP_CLIENT_JDK),
132 "Protocol=" + protocol,
133 "CipherSuite=" + cipherSuite,
134 "ServerName=" + serverName,
135 "AppProtocols=" + appProtocols));
136
137 Status status = Status.SUCCESS;
138 Client client = null;
139 try {
140 client = new Client(Cert.getCerts(CipherSuite.cipherSuite(cipherSuite)));
141 client.setEnabledProtocols(protocol);
142 client.setEnabledCipherSuites(cipherSuite);
143
144 if (serverName != null) {
145 if (supportsSNIOnClient) {
146 client.setServerName(serverName);
147 } else {
148 System.out.println(
149 "Ignored due to client doesn't support SNI.");
150 }
151 }
152
153 if (appProtocols != null) {
154 if (supportsALPNOnClient) {
155 client.setApplicationProtocols(
156 Utils.split(appProtocols, Utils.VALUE_DELIMITER));
157 } else {
158 System.out.println(
159 "Ignored due to client doesn't support ALPN.");
160 }
|