Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/PlugTransportService.java
41161 views
1
/*
2
* Copyright (c) 2003, 2018, 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
* A Super class for Transport Services used by
26
* nsk/jdi/PlugConnectors tests
27
*/
28
29
package nsk.share.jdi;
30
31
import com.sun.jdi.*;
32
import com.sun.jdi.connect.*;
33
import com.sun.jdi.connect.spi.*;
34
import java.io.*;
35
import java.util.*;
36
37
public class PlugTransportService extends TransportService {
38
39
String plugTransportServiceName = "Undefined_PlugTransportService_Name";
40
String plugTransportServiceDescription = "Undefined_PlugTransportService_Description";
41
TransportService.Capabilities plugTransportServiceCapabilities = new TestCapabilities();
42
43
/*
44
* Simple implementation of TransportService.Capabilities
45
*/
46
public static class TestCapabilities extends TransportService.Capabilities {
47
boolean supportsAcceptTimeout = false;
48
boolean supportsAttachTimeout = false;
49
boolean supportsHandshakeTimeout = false;
50
boolean supportsMultipleConnections = false;
51
52
public TestCapabilities() {
53
}
54
55
public TestCapabilities(
56
boolean supportsAcceptTimeout,
57
boolean supportsAttachTimeout,
58
boolean supportsHandshakeTimeout,
59
boolean supportsMultipleConnections) {
60
61
this.supportsAcceptTimeout = supportsAcceptTimeout;
62
this.supportsAttachTimeout = supportsAttachTimeout;
63
this.supportsHandshakeTimeout = supportsHandshakeTimeout;
64
this.supportsMultipleConnections = supportsMultipleConnections;
65
}
66
67
public boolean supportsAcceptTimeout() {
68
return supportsAcceptTimeout;
69
}
70
71
public boolean supportsAttachTimeout() {
72
return supportsAttachTimeout;
73
}
74
75
public boolean supportsHandshakeTimeout() {
76
return supportsHandshakeTimeout;
77
}
78
79
public boolean supportsMultipleConnections() {
80
return supportsMultipleConnections;
81
}
82
83
} // end of TestCapabilities static class
84
85
/*
86
* Simple implementation of TransportService.ListenKey
87
*/
88
public static class TestListenKey extends TransportService.ListenKey {
89
String address = null;
90
91
public TestListenKey() {
92
}
93
94
public TestListenKey(String address) {
95
96
this.address = address;
97
}
98
99
public String address() {
100
return address;
101
}
102
103
} // end of TestListenKey static class
104
105
public PlugTransportService() {
106
}
107
108
public PlugTransportService(
109
String plugTransportServiceName,
110
String plugTransportServiceDescription,
111
TransportService.Capabilities plugTransportServiceCapabilities
112
) {
113
114
this.plugTransportServiceName = plugTransportServiceName;
115
this.plugTransportServiceDescription = plugTransportServiceDescription;
116
this.plugTransportServiceCapabilities = plugTransportServiceCapabilities;
117
}
118
119
public String name() {
120
return plugTransportServiceName;
121
}
122
123
public String description() {
124
return plugTransportServiceDescription;
125
}
126
127
public TransportService.Capabilities capabilities() {
128
return plugTransportServiceCapabilities;
129
}
130
131
public Connection attach(
132
String address,
133
long attachTimeout,
134
long handshakeTimeout) throws IOException {
135
136
String exceptionMessage = "## PlugTransportService: TransportService name = '" +
137
plugTransportServiceName + "';\nNon-authorized call of attach(...) method!";
138
139
if ( true ) {
140
throw new RuntimeException(exceptionMessage);
141
}
142
143
return null;
144
}
145
146
public TransportService.ListenKey startListening(String address) throws IOException {
147
148
String exceptionMessage = "## PlugTransportService: TransportService name = '" +
149
plugTransportServiceName + "';\nNon-authorized call of startListening(...) method!";
150
151
if ( true ) {
152
throw new RuntimeException(exceptionMessage);
153
}
154
155
return null;
156
}
157
158
public TransportService.ListenKey startListening() throws IOException {
159
160
String exceptionMessage = "## PlugTransportService: TransportService name = '" +
161
plugTransportServiceName + "';\nNon-authorized call of startListening() method!";
162
163
if ( true ) {
164
throw new RuntimeException(exceptionMessage);
165
}
166
167
return null;
168
}
169
170
public void stopListening(TransportService.ListenKey listenKey) throws IOException {
171
172
String exceptionMessage = "## PlugTransportService: TransportService name = '" +
173
plugTransportServiceName + "';\nNon-authorized call of stopListening() method!";
174
175
if ( true ) {
176
throw new RuntimeException(exceptionMessage);
177
}
178
}
179
180
public Connection accept(
181
TransportService.ListenKey listenKey,
182
long acceptTimeout,
183
long handshakeTimeout) throws IOException {
184
185
String exceptionMessage = "## PlugTransportService: TransportService name = '" +
186
plugTransportServiceName + "';\nNon-authorized call of accept(...) method!";
187
188
if ( true ) {
189
throw new RuntimeException(exceptionMessage);
190
}
191
192
return null;
193
}
194
195
/*
196
* Simple implementation of Connection
197
*/
198
public static class PlugTransportServiceConnection extends Connection {
199
200
public void close() throws IOException {
201
String exceptionMessage =
202
"## PlugTransportConnection: \nNon-authorized call of close() method!";
203
204
if ( true ) {
205
throw new RuntimeException(exceptionMessage);
206
}
207
}
208
209
public boolean isOpen() {
210
String exceptionMessage =
211
"## PlugTransportConnection: \nNon-authorized call of isOpen() method!";
212
213
if ( true ) {
214
throw new RuntimeException(exceptionMessage);
215
}
216
return false;
217
}
218
219
public byte[] readPacket() throws IOException {
220
String exceptionMessage =
221
"## PlugTransportConnection: \nNon-authorized call of readPacket() method!";
222
223
if ( true ) {
224
throw new ClosedConnectionException(exceptionMessage);
225
}
226
227
if ( true ) {
228
throw new ClosedConnectionException();
229
}
230
231
return null;
232
}
233
234
public void writePacket(byte[] pkt) throws IOException {
235
String exceptionMessage =
236
"## PlugTransportConnection: \nNon-authorized call of writePacket(...) method!";
237
238
if ( true ) {
239
throw new ClosedConnectionException(exceptionMessage);
240
}
241
242
if ( true ) {
243
throw new ClosedConnectionException();
244
}
245
246
}
247
248
} // end of PlugTransportServiceConnection class
249
250
} // end of PlugTransportService class
251
252