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;