author | mli |
Fri, 16 Mar 2018 18:15:31 +0800 | |
changeset 49255 | acdb8531cc8b |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
49255
acdb8531cc8b
8199215: Re-examine getFreePort method in test infrastructure library
mli
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* @test |
|
25 |
* @summary Test socket-channel connection-state transitions |
|
49255
acdb8531cc8b
8199215: Re-examine getFreePort method in test infrastructure library
mli
parents:
47216
diff
changeset
|
26 |
* @library .. /test/lib |
acdb8531cc8b
8199215: Re-examine getFreePort method in test infrastructure library
mli
parents:
47216
diff
changeset
|
27 |
* @build jdk.test.lib.Utils TestServers |
acdb8531cc8b
8199215: Re-examine getFreePort method in test infrastructure library
mli
parents:
47216
diff
changeset
|
28 |
* @run main ConnectState |
2 | 29 |
*/ |
30 |
||
31 |
import java.io.*; |
|
32 |
import java.net.*; |
|
33 |
import java.nio.*; |
|
34 |
import java.nio.channels.*; |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
35 |
import java.util.Arrays; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
36 |
import java.util.Collection; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
37 |
import java.util.Collections; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
38 |
import java.util.HashSet; |
2 | 39 |
|
40 |
||
41 |
public class ConnectState { |
|
42 |
||
43 |
static PrintStream log = System.err; |
|
44 |
||
45 |
static InetSocketAddress remote; |
|
46 |
||
47 |
final static int ST_UNCONNECTED = 0; |
|
48 |
final static int ST_PENDING = 1; |
|
49 |
final static int ST_CONNECTED = 2; |
|
50 |
final static int ST_CLOSED = 3; |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
51 |
final static int ST_PENDING_OR_CONNECTED = 4; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
52 |
// NO exceptions expected |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
53 |
final static Collection<Class<?>> NONE = Collections.emptySet(); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
54 |
|
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
55 |
// make a set of expected exception. |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
56 |
static Collection<Class<?>> expectedExceptions(Class<?>... expected) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
57 |
final Collection<Class<?>> exceptions; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
58 |
if (expected.length == 0) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
59 |
exceptions = NONE; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
60 |
} else if (expected.length == 1) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
61 |
assert expected[0] != null; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
62 |
exceptions = Collections.<Class<?>>singleton(expected[0]); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
63 |
} else { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
64 |
exceptions = new HashSet<>(Arrays.asList(expected)); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
65 |
} |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
66 |
return exceptions; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
67 |
} |
2 | 68 |
|
69 |
static abstract class Test { |
|
70 |
||
71 |
abstract String go(SocketChannel sc) throws Exception; |
|
72 |
||
73 |
static void check(boolean test, String desc) throws Exception { |
|
74 |
if (!test) |
|
75 |
throw new Exception("Incorrect state: " + desc); |
|
76 |
} |
|
77 |
||
78 |
static void check(SocketChannel sc, int state) throws Exception { |
|
79 |
switch (state) { |
|
80 |
case ST_UNCONNECTED: |
|
81 |
check(!sc.isConnected(), "!isConnected"); |
|
82 |
check(!sc.isConnectionPending(), "!isConnectionPending"); |
|
83 |
check(sc.isOpen(), "isOpen"); |
|
84 |
break; |
|
85 |
case ST_PENDING: |
|
86 |
check(!sc.isConnected(), "!isConnected"); |
|
87 |
check(sc.isConnectionPending(), "isConnectionPending"); |
|
88 |
check(sc.isOpen(), "isOpen"); |
|
89 |
break; |
|
90 |
case ST_CONNECTED: |
|
91 |
check(sc.isConnected(), "isConnected"); |
|
92 |
check(!sc.isConnectionPending(), "!isConnectionPending"); |
|
93 |
check(sc.isOpen(), "isOpen"); |
|
94 |
break; |
|
95 |
case ST_CLOSED: |
|
96 |
check(sc.isConnected(), "isConnected"); |
|
97 |
check(!sc.isConnectionPending(), "!isConnectionPending"); |
|
98 |
check(sc.isOpen(), "isOpen"); |
|
99 |
break; |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
100 |
case ST_PENDING_OR_CONNECTED: |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
101 |
check(sc.isConnected() || sc.isConnectionPending(), |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
102 |
"isConnected || isConnectionPending"); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
103 |
check(sc.isOpen(), "isOpen"); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
104 |
break; |
2 | 105 |
} |
106 |
} |
|
107 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
108 |
Test(String name, Class<?> exception, int state) throws Exception { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
109 |
this(name, expectedExceptions(exception), state); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
110 |
} |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
111 |
|
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
112 |
// On some architecture we may need to accept several exceptions. |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
113 |
// For instance on Solaris, when using a server colocated on the |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
114 |
// machine we cannot guarantee that we will get a |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
115 |
// ConnectionPendingException when connecting twice on the same |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
116 |
// non-blocking socket. We may instead get a an |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
117 |
// AlreadyConnectedException, which is also valid: it simply means |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
118 |
// that the first connection has been immediately accepted. |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
119 |
Test(String name, Collection<Class<?>> exceptions, int state) |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
120 |
throws Exception { |
2 | 121 |
SocketChannel sc = SocketChannel.open(); |
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
122 |
String note; |
2 | 123 |
try { |
124 |
try { |
|
125 |
note = go(sc); |
|
126 |
} catch (Exception x) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
127 |
Class<?> expectedExceptionClass = null; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
128 |
for (Class<?> exception : exceptions) { |
2 | 129 |
if (exception.isInstance(x)) { |
130 |
log.println(name + ": As expected: " |
|
131 |
+ x); |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
132 |
expectedExceptionClass = exception; |
2 | 133 |
check(sc, state); |
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
134 |
break; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
135 |
} |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
136 |
} |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
137 |
if (expectedExceptionClass == null |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
138 |
&& !exceptions.isEmpty()) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
139 |
// we had an exception, but it's not of the set of |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
140 |
// exceptions we expected. |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
141 |
throw new Exception(name |
2 | 142 |
+ ": Incorrect exception", |
143 |
x); |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
144 |
} else if (exceptions.isEmpty()) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
145 |
// we didn't expect any exception |
2 | 146 |
throw new Exception(name |
147 |
+ ": Unexpected exception", |
|
148 |
x); |
|
149 |
} |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
150 |
// if we reach here, we have our expected exception |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
151 |
assert expectedExceptionClass != null; |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
152 |
return; |
2 | 153 |
} |
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
154 |
if (!exceptions.isEmpty()) { |
2 | 155 |
throw new Exception(name |
156 |
+ ": Expected exception not thrown: " |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
157 |
+ exceptions.iterator().next()); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
158 |
} |
2 | 159 |
check(sc, state); |
160 |
log.println(name + ": Returned normally" |
|
161 |
+ ((note != null) ? ": " + note : "")); |
|
162 |
} finally { |
|
163 |
if (sc.isOpen()) |
|
164 |
sc.close(); |
|
165 |
} |
|
166 |
} |
|
167 |
||
168 |
} |
|
169 |
||
170 |
static void tests() throws Exception { |
|
171 |
log.println(remote); |
|
172 |
||
173 |
new Test("Read unconnected", NotYetConnectedException.class, |
|
174 |
ST_UNCONNECTED) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
175 |
@Override |
2 | 176 |
String go(SocketChannel sc) throws Exception { |
177 |
ByteBuffer b = ByteBuffer.allocateDirect(1024); |
|
178 |
sc.read(b); |
|
179 |
return null; |
|
180 |
}}; |
|
181 |
||
182 |
new Test("Write unconnected", NotYetConnectedException.class, |
|
183 |
ST_UNCONNECTED) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
184 |
@Override |
2 | 185 |
String go(SocketChannel sc) throws Exception { |
186 |
ByteBuffer b = ByteBuffer.allocateDirect(1024); |
|
187 |
sc.write(b); |
|
188 |
return null; |
|
189 |
}}; |
|
190 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
191 |
new Test("Simple connect", NONE, ST_CONNECTED) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
192 |
@Override |
2 | 193 |
String go(SocketChannel sc) throws Exception { |
194 |
sc.connect(remote); |
|
195 |
return null; |
|
196 |
}}; |
|
197 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
198 |
new Test("Simple connect & finish", NONE, ST_CONNECTED) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
199 |
@Override |
2 | 200 |
String go(SocketChannel sc) throws Exception { |
201 |
sc.connect(remote); |
|
202 |
if (!sc.finishConnect()) |
|
203 |
throw new Exception("finishConnect returned false"); |
|
204 |
return null; |
|
205 |
}}; |
|
206 |
||
207 |
new Test("Double connect", |
|
208 |
AlreadyConnectedException.class, ST_CONNECTED) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
209 |
@Override |
2 | 210 |
String go(SocketChannel sc) throws Exception { |
211 |
sc.connect(remote); |
|
212 |
sc.connect(remote); |
|
213 |
return null; |
|
214 |
}}; |
|
215 |
||
216 |
new Test("Finish w/o start", |
|
217 |
NoConnectionPendingException.class, ST_UNCONNECTED) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
218 |
@Override |
2 | 219 |
String go(SocketChannel sc) throws Exception { |
220 |
sc.finishConnect(); |
|
221 |
return null; |
|
222 |
}}; |
|
223 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
224 |
// Note: using our local EchoServer rather than echo on a distant |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
225 |
// host - we see that Tries to finish = 0 (instead of ~ 18). |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
226 |
new Test("NB simple connect", NONE, ST_CONNECTED) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
227 |
@Override |
2 | 228 |
String go(SocketChannel sc) throws Exception { |
229 |
sc.configureBlocking(false); |
|
230 |
sc.connect(remote); |
|
231 |
int n = 0; |
|
232 |
while (!sc.finishConnect()) { |
|
233 |
Thread.sleep(10); |
|
234 |
n++; |
|
235 |
} |
|
236 |
sc.finishConnect(); // Check redundant invocation |
|
237 |
return ("Tries to finish = " + n); |
|
238 |
}}; |
|
239 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
240 |
// Note: using our local EchoServer rather than echo on a distant |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
241 |
// host - we cannot guarantee that this test will get a |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
242 |
// a ConnectionPendingException: it may get an |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
243 |
// AlreadyConnectedException, so we should allow for both. |
2 | 244 |
new Test("NB double connect", |
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
245 |
expectedExceptions(ConnectionPendingException.class, |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
246 |
AlreadyConnectedException.class), |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
247 |
ST_PENDING_OR_CONNECTED) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
248 |
@Override |
2 | 249 |
String go(SocketChannel sc) throws Exception { |
250 |
sc.configureBlocking(false); |
|
251 |
sc.connect(remote); |
|
252 |
sc.connect(remote); |
|
253 |
return null; |
|
254 |
}}; |
|
255 |
||
256 |
new Test("NB finish w/o start", |
|
257 |
NoConnectionPendingException.class, ST_UNCONNECTED) { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
258 |
@Override |
2 | 259 |
String go(SocketChannel sc) throws Exception { |
260 |
sc.configureBlocking(false); |
|
261 |
sc.finishConnect(); |
|
262 |
return null; |
|
263 |
}}; |
|
264 |
||
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
265 |
new Test("NB connect, B finish", NONE, ST_CONNECTED) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
266 |
@Override |
2 | 267 |
String go(SocketChannel sc) throws Exception { |
268 |
sc.configureBlocking(false); |
|
269 |
sc.connect(remote); |
|
270 |
sc.configureBlocking(true); |
|
271 |
sc.finishConnect(); |
|
272 |
return null; |
|
273 |
}}; |
|
274 |
||
275 |
} |
|
276 |
||
277 |
public static void main(String[] args) throws Exception { |
|
14415
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
278 |
try (TestServers.EchoServer echoServer |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
279 |
= TestServers.EchoServer.startNewServer(500)) { |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
280 |
remote = new InetSocketAddress(echoServer.getAddress(), |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
281 |
echoServer.getPort()); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
282 |
tests(); |
7a31b0e0cfaf
6720349: (ch) Channels tests depending on hosts inside Sun
dfuchs
parents:
5506
diff
changeset
|
283 |
} |
2 | 284 |
} |
285 |
||
286 |
} |