Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/net/ssl/TLSCommon/interop/ExtUseCase.java
41154 views
1
/*
2
* Copyright (c) 2020, 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
*/
23
24
/*
25
* The extended SSL/TLS communication parameters.
26
*/
27
public class ExtUseCase extends UseCase {
28
29
// The server-acceptable SNI server name patterns;
30
// Or the client-desired SNI server names.
31
private String[] serverNames = null;
32
33
// The supported application protocols.
34
private String[] appProtocols = null;
35
36
// The supported named groups.
37
private NamedGroup[] namedGroups = null;
38
39
public static ExtUseCase newInstance() {
40
return new ExtUseCase();
41
}
42
43
public String[] getServerNames() {
44
return serverNames;
45
}
46
47
public String getServerName() {
48
return serverNames != null && serverNames.length > 0
49
? serverNames[0]
50
: null;
51
}
52
53
public ExtUseCase setServerNames(String... serverNames) {
54
this.serverNames = serverNames;
55
return this;
56
}
57
58
public String[] getAppProtocols() {
59
return appProtocols;
60
}
61
62
public String getAppProtocol() {
63
return appProtocols != null && appProtocols.length > 0
64
? appProtocols[0]
65
: null;
66
}
67
68
public ExtUseCase setAppProtocols(String... appProtocols) {
69
this.appProtocols = appProtocols;
70
return this;
71
}
72
73
public NamedGroup[] getNamedGroups() {
74
return namedGroups;
75
}
76
77
public String getNamedGroup() {
78
return namedGroups != null && namedGroups.length > 0
79
? appProtocols[0]
80
: null;
81
}
82
83
public ExtUseCase setNamedGroups(NamedGroup... namedGroups) {
84
this.namedGroups = namedGroups;
85
return this;
86
}
87
88
@Override
89
public String toString() {
90
return Utilities.join(Utilities.PARAM_DELIMITER,
91
super.toString(),
92
Utilities.joinNameValue(
93
"serverNames", Utilities.join(serverNames)),
94
Utilities.joinNameValue(
95
"appProtocols", Utilities.join(appProtocols)),
96
Utilities.joinNameValue(
97
"NamedGroups", Utilities.join(namedGroups)));
98
}
99
}
100
101