Path: blob/master/test/jdk/javax/net/ssl/TLSCommon/interop/ExtUseCase.java
41154 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* The extended SSL/TLS communication parameters.25*/26public class ExtUseCase extends UseCase {2728// The server-acceptable SNI server name patterns;29// Or the client-desired SNI server names.30private String[] serverNames = null;3132// The supported application protocols.33private String[] appProtocols = null;3435// The supported named groups.36private NamedGroup[] namedGroups = null;3738public static ExtUseCase newInstance() {39return new ExtUseCase();40}4142public String[] getServerNames() {43return serverNames;44}4546public String getServerName() {47return serverNames != null && serverNames.length > 048? serverNames[0]49: null;50}5152public ExtUseCase setServerNames(String... serverNames) {53this.serverNames = serverNames;54return this;55}5657public String[] getAppProtocols() {58return appProtocols;59}6061public String getAppProtocol() {62return appProtocols != null && appProtocols.length > 063? appProtocols[0]64: null;65}6667public ExtUseCase setAppProtocols(String... appProtocols) {68this.appProtocols = appProtocols;69return this;70}7172public NamedGroup[] getNamedGroups() {73return namedGroups;74}7576public String getNamedGroup() {77return namedGroups != null && namedGroups.length > 078? appProtocols[0]79: null;80}8182public ExtUseCase setNamedGroups(NamedGroup... namedGroups) {83this.namedGroups = namedGroups;84return this;85}8687@Override88public String toString() {89return Utilities.join(Utilities.PARAM_DELIMITER,90super.toString(),91Utilities.joinNameValue(92"serverNames", Utilities.join(serverNames)),93Utilities.joinNameValue(94"appProtocols", Utilities.join(appProtocols)),95Utilities.joinNameValue(96"NamedGroups", Utilities.join(namedGroups)));97}98}99100101