From e8d3014547ee27cbd5bb0dcd27a05d92c91b97a6 Mon Sep 17 00:00:00 2001 From: HttpMarco Date: Fri, 29 Nov 2024 20:39:26 +0100 Subject: [PATCH] Test pipeline --- .../dev/httpmarco/netline/client/NetClientHandler.java | 3 ++- .../dev/httpmarco/netline/tests/SecurityListTest.java | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/httpmarco/netline/client/NetClientHandler.java b/src/main/java/dev/httpmarco/netline/client/NetClientHandler.java index 4a44ee1..2279dee 100644 --- a/src/main/java/dev/httpmarco/netline/client/NetClientHandler.java +++ b/src/main/java/dev/httpmarco/netline/client/NetClientHandler.java @@ -5,6 +5,7 @@ import dev.httpmarco.netline.packet.common.BroadcastPacket; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; public final class NetClientHandler extends NetCompHandler { @@ -36,7 +37,7 @@ public void handshakeChannel(NetChannel netChannel) { } @Override - public void broadcastDefinition(NetChannel incoming, BroadcastPacket packet) { + public void broadcastDefinition(NetChannel incoming, @NotNull BroadcastPacket packet) { netClient.callTracking(incoming, packet.packet()); } } diff --git a/src/test/java/dev/httpmarco/netline/tests/SecurityListTest.java b/src/test/java/dev/httpmarco/netline/tests/SecurityListTest.java index c32de86..f45bcb6 100644 --- a/src/test/java/dev/httpmarco/netline/tests/SecurityListTest.java +++ b/src/test/java/dev/httpmarco/netline/tests/SecurityListTest.java @@ -14,7 +14,7 @@ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @DisplayName("3 - White-/Blacklist test") -public class SecurityListTest { +public final class SecurityListTest { private static NetServer server; @@ -28,7 +28,7 @@ public static void createTestSetup() { @Test @Order(1) @DisplayName("3.1 Test hostname whitelist") - public void testHostNameWhitelist() { + public void testHostNameWhitelist() throws InterruptedException { var result = new AtomicBoolean(false); var whitelistedIp = "127.0.0.2"; @@ -38,6 +38,8 @@ public void testHostNameWhitelist() { var testClient = Net.line().client(); testClient.bootSync(); + Thread.sleep(1000); + if(testClient.state() == NetClientState.CONNECTED) { testClient.closeSync(); assert false; @@ -53,7 +55,7 @@ public void testHostNameWhitelist() { @Test @Order(2) @DisplayName("3.2 Test hostname blacklist") - public void testBlacklist() { + public void testBlacklist() throws InterruptedException { var result = new AtomicBoolean(false); var blockedIp = "127.0.0.1"; @@ -64,6 +66,8 @@ public void testBlacklist() { var testClient = Net.line().client(); testClient.bootSync(); + Thread.sleep(1000); + if(testClient.state() == NetClientState.CONNECTED) { testClient.closeSync(); assert false;