✅ Make tests more realistic by running listeners in a different thread
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 6 Sep 2024 21:10:40 +0000 (23:10 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 6 Sep 2024 21:10:40 +0000 (23:10 +0200)
src/test/java/net/pterodactylus/fcp/highlevel/FcpClientTest.java

index e86bb85..92a0e4b 100644 (file)
@@ -528,7 +528,7 @@ public class FcpClientTest {
                        @Override
                        public void sendMessage(FcpMessage fcpMessage) {
                                BiConsumer<FcpListener, FcpConnection> listenerNotifier = messageConsumer.apply(fcpMessage);
-                               listeners.forEach(listener -> listenerNotifier.accept(listener, this));
+                               new Thread(() -> listeners.forEach(listener -> listenerNotifier.accept(listener, this))).start();
                        }
                };
        }