From e5864f728eff73e166aed5e30a26824a5bacf5c1 Mon Sep 17 00:00:00 2001 From: Andrey Pangin Date: Mon, 26 Jul 2021 02:09:09 +0300 Subject: [PATCH] Fixed tests --- test/one/nio/net/JavaDatagramSocketTest.java | 2 +- test/one/nio/os/bpf/BpfMapTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/one/nio/net/JavaDatagramSocketTest.java b/test/one/nio/net/JavaDatagramSocketTest.java index c32978e..9ba2c45 100644 --- a/test/one/nio/net/JavaDatagramSocketTest.java +++ b/test/one/nio/net/JavaDatagramSocketTest.java @@ -16,7 +16,7 @@ public class JavaDatagramSocketTest { @Test public void testConnectedSocket() throws IOException { DatagramChannel jdkChannel = DatagramChannel.open(); - jdkChannel.bind(new InetSocketAddress(InetAddress.getLocalHost(), 0)); + jdkChannel.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); jdkChannel.socket().setSoTimeout(1000); JavaDatagramSocket oneSocket = new JavaDatagramSocket(); diff --git a/test/one/nio/os/bpf/BpfMapTest.java b/test/one/nio/os/bpf/BpfMapTest.java index 87cf418..25d6296 100644 --- a/test/one/nio/os/bpf/BpfMapTest.java +++ b/test/one/nio/os/bpf/BpfMapTest.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.nio.LongBuffer; import org.junit.Test; @@ -82,7 +83,7 @@ public void testPerCpuMap() throws IOException { assert map.totalValueSize == 8 * BpfMap.CPUS; assert map.get(BpfMap.bytes(1)) == null; - ByteBuffer buf = ByteBuffer.allocate(map.totalValueSize); + ByteBuffer buf = ByteBuffer.allocate(map.totalValueSize).order(ByteOrder.nativeOrder()); LongBuffer lbuf = buf.asLongBuffer(); for (int i = 0; i < BpfMap.CPUS; i++) { lbuf.put(i);