diff --git a/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java b/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java index e985cee6dd142c..212504f7ca8c78 100644 --- a/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java +++ b/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnMessageTest.java @@ -94,7 +94,7 @@ public void assertBroadcast(URI testUri) throws Exception { assertTrue(connectedLatch.await(5, TimeUnit.SECONDS)); ws1.get().writeTextMessage("hello"); assertTrue(onMessageLatch.await(5, TimeUnit.SECONDS)); - assertEquals(2, messages.size()); + assertEquals(2, messages.size(), "Messages: " + messages); // Both messages come from the first client assertEquals("1:HELLO", messages.get(0)); assertEquals("1:HELLO", messages.get(1)); diff --git a/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java b/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java index f69285d26fe0f6..e9bfe273e15138 100644 --- a/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java +++ b/extensions/websockets-next/server/deployment/src/test/java/io/quarkus/websockets/next/test/broadcast/BroadcastOnOpenTest.java @@ -101,7 +101,7 @@ public void assertBroadcast(URI testUri) throws Exception { } }); assertTrue(c2ConnectedLatch.await(5, TimeUnit.SECONDS)); - assertTrue(c2MessageLatch.await(10, TimeUnit.SECONDS)); + assertTrue(c2MessageLatch.await(5, TimeUnit.SECONDS), "Messages: " + messages); // onOpen should be broadcasted to both clients assertEquals(2, messages.size()); assertEquals("c2", messages.get(0)); diff --git a/extensions/websockets-next/server/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketEndpointBase.java b/extensions/websockets-next/server/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketEndpointBase.java index 218c848fc3879b..417b801b198999 100644 --- a/extensions/websockets-next/server/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketEndpointBase.java +++ b/extensions/websockets-next/server/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketEndpointBase.java @@ -208,11 +208,18 @@ protected Uni sendText(String message, boolean broadcast) { } protected Uni multiText(Multi multi, boolean broadcast, Function> itemFun) { - multi.onFailure().call(connection::close).subscribe().with( - m -> { - itemFun.apply(m).subscribe().with(v -> LOG.debugf("Multi >> text message: %s", connection), - t -> LOG.errorf(t, "Unable to send text message from Multi: %s", connection)); - }); + multi.onFailure() + .call(connection::close) + .subscribe().with( + m -> { + itemFun.apply(m) + .subscribe() + .with(v -> LOG.debugf("Multi >> text message: %s", connection), + t -> LOG.errorf(t, "Unable to send text message from Multi: %s", connection)); + }, + t -> { + LOG.errorf(t, "Unable to send text message from Multi - connection was closed: %s ", connection); + }); return Uni.createFrom().voidItem(); } @@ -221,11 +228,18 @@ protected Uni sendBinary(Buffer message, boolean broadcast) { } protected Uni multiBinary(Multi multi, boolean broadcast, Function> itemFun) { - multi.onFailure().call(connection::close).subscribe().with( - m -> { - itemFun.apply(m).subscribe().with(v -> LOG.debugf("Multi >> binary message: %s", connection), - t -> LOG.errorf(t, "Unable to send binary message from Multi: %s", connection)); - }); + multi.onFailure() + .call(connection::close) + .subscribe().with( + m -> { + itemFun.apply(m) + .subscribe() + .with(v -> LOG.debugf("Multi >> binary message: %s", connection), + t -> LOG.errorf(t, "Unable to send binary message from Multi: %s", connection)); + }, + t -> { + LOG.errorf(t, "Unable to send text message from Multi - connection was closed: %s ", connection); + }); return Uni.createFrom().voidItem(); } }