Skip to content

Commit 3bae974

Browse files
committed
Fix WebSocket fragment tests that weren't sending continuation frames
1 parent 14b91c0 commit 3bae974

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

client/src/test/java/org/asynchttpclient/ws/AbstractBasicWebSocketTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public WebSocketHandler configureHandler() {
4343
return new WebSocketHandler() {
4444
@Override
4545
public void configure(WebSocketServletFactory factory) {
46-
factory.register(EchoSocket.class);
46+
factory.register(EchoWebSocket.class);
4747
}
4848
};
4949
}

client/src/test/java/org/asynchttpclient/ws/ByteMessageTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ByteMessageTest extends AbstractBasicWebSocketTest {
2626

2727
private static final byte[] ECHO_BYTES = "ECHO".getBytes(StandardCharsets.UTF_8);
2828

29-
@Test(groups = "standalone")
29+
@Test
3030
public void echoByte() throws Exception {
3131
try (AsyncHttpClient c = asyncHttpClient()) {
3232
final CountDownLatch latch = new CountDownLatch(1);
@@ -63,7 +63,7 @@ public void onBinaryFrame(byte[] frame, boolean finalFragment, int rsv) {
6363
}
6464
}
6565

66-
@Test(groups = "standalone")
66+
@Test
6767
public void echoTwoMessagesTest() throws Exception {
6868
try (AsyncHttpClient c = asyncHttpClient()) {
6969
final CountDownLatch latch = new CountDownLatch(2);
@@ -154,6 +154,7 @@ public void onBinaryFrame(byte[] frame, boolean finalFragment, int rsv) {
154154
}
155155
}
156156

157+
@Test
157158
public void echoFragments() throws Exception {
158159
try (AsyncHttpClient c = asyncHttpClient()) {
159160
final CountDownLatch latch = new CountDownLatch(1);
@@ -191,7 +192,7 @@ public void onBinaryFrame(byte[] frame, boolean finalFragment, int rsv) {
191192

192193
}).build()).get();
193194
websocket.sendBinaryFrame(ECHO_BYTES, false, 0);
194-
websocket.sendBinaryFrame(ECHO_BYTES, true, 0);
195+
websocket.sendContinuationFrame(ECHO_BYTES, true, 0);
195196
latch.await();
196197
assertEquals(text.get(), "ECHOECHO".getBytes());
197198
}

client/src/test/java/org/asynchttpclient/ws/EchoSocket.java renamed to client/src/test/java/org/asynchttpclient/ws/EchoWebSocket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.io.IOException;
2020
import java.nio.ByteBuffer;
2121

22-
public class EchoSocket extends WebSocketAdapter {
22+
public class EchoWebSocket extends WebSocketAdapter {
2323

2424
@Override
2525
public void onWebSocketConnect(Session sess) {

client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public class TextMessageTest extends AbstractBasicWebSocketTest {
2929

30-
@Test(groups = "standalone", timeOut = 60000)
30+
@Test(timeOut = 60000)
3131
public void onOpen() throws Exception {
3232
try (AsyncHttpClient c = asyncHttpClient()) {
3333
final CountDownLatch latch = new CountDownLatch(1);
@@ -57,7 +57,7 @@ public void onError(Throwable t) {
5757
}
5858
}
5959

60-
@Test(groups = "standalone", timeOut = 60000)
60+
@Test(timeOut = 60000)
6161
public void onEmptyListenerTest() throws Exception {
6262
try (AsyncHttpClient c = asyncHttpClient()) {
6363
WebSocket websocket = null;
@@ -70,7 +70,7 @@ public void onEmptyListenerTest() throws Exception {
7070
}
7171
}
7272

73-
@Test(groups = "standalone", timeOut = 60000, expectedExceptions = UnknownHostException.class)
73+
@Test(timeOut = 60000, expectedExceptions = UnknownHostException.class)
7474
public void onFailureTest() throws Throwable {
7575
try (AsyncHttpClient c = asyncHttpClient()) {
7676
c.prepareGet("ws://abcdefg").execute(new WebSocketUpgradeHandler.Builder().build()).get();
@@ -79,7 +79,7 @@ public void onFailureTest() throws Throwable {
7979
}
8080
}
8181

82-
@Test(groups = "standalone", timeOut = 60000)
82+
@Test(timeOut = 60000)
8383
public void onTimeoutCloseTest() throws Exception {
8484
try (AsyncHttpClient c = asyncHttpClient()) {
8585
final CountDownLatch latch = new CountDownLatch(1);
@@ -109,7 +109,7 @@ public void onError(Throwable t) {
109109
}
110110
}
111111

112-
@Test(groups = "standalone", timeOut = 60000)
112+
@Test(timeOut = 60000)
113113
public void onClose() throws Exception {
114114
try (AsyncHttpClient c = asyncHttpClient()) {
115115
final CountDownLatch latch = new CountDownLatch(1);
@@ -141,7 +141,7 @@ public void onError(Throwable t) {
141141
}
142142
}
143143

144-
@Test(groups = "standalone", timeOut = 60000)
144+
@Test(timeOut = 60000)
145145
public void echoText() throws Exception {
146146
try (AsyncHttpClient c = asyncHttpClient()) {
147147
final CountDownLatch latch = new CountDownLatch(1);
@@ -178,7 +178,7 @@ public void onError(Throwable t) {
178178
}
179179
}
180180

181-
@Test(groups = "standalone", timeOut = 60000)
181+
@Test(timeOut = 60000)
182182
public void echoDoubleListenerText() throws Exception {
183183
try (AsyncHttpClient c = asyncHttpClient()) {
184184
final CountDownLatch latch = new CountDownLatch(2);
@@ -237,7 +237,7 @@ public void onError(Throwable t) {
237237
}
238238
}
239239

240-
@Test(groups = "standalone")
240+
@Test
241241
public void echoTwoMessagesTest() throws Exception {
242242
try (AsyncHttpClient c = asyncHttpClient()) {
243243
final CountDownLatch latch = new CountDownLatch(2);
@@ -274,6 +274,7 @@ public void onError(Throwable t) {
274274
}
275275
}
276276

277+
@Test
277278
public void echoFragments() throws Exception {
278279
try (AsyncHttpClient c = asyncHttpClient()) {
279280
final CountDownLatch latch = new CountDownLatch(1);
@@ -304,14 +305,14 @@ public void onError(Throwable t) {
304305
}).build()).get();
305306

306307
websocket.sendTextFrame("ECHO", false, 0);
307-
websocket.sendTextFrame("ECHO", true, 0);
308+
websocket.sendContinuationFrame("ECHO", true, 0);
308309

309310
latch.await();
310311
assertEquals(text.get(), "ECHOECHO");
311312
}
312313
}
313314

314-
@Test(groups = "standalone", timeOut = 60000)
315+
@Test(timeOut = 60000)
315316
public void echoTextAndThenClose() throws Throwable {
316317
try (AsyncHttpClient c = asyncHttpClient()) {
317318
final CountDownLatch textLatch = new CountDownLatch(1);

0 commit comments

Comments
 (0)