diff --git a/codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java b/codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java index 0672453cd7..c72263ea08 100644 --- a/codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java +++ b/codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java @@ -19,7 +19,9 @@ import io.netty.channel.embedded.EmbeddedChannel; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import org.junit.Test; -import sun.net.util.IPAddressUtil; + +import java.net.InetAddress; +import java.net.UnknownHostException; import static org.junit.Assert.*; @@ -62,8 +64,8 @@ public class SocksCmdRequestDecoderTest { } @Test - public void testCmdRequestDecoderIPv6() { - String[] hosts = {SocksCommonUtils.ipv6toStr(IPAddressUtil.textToNumericFormatV6("::1"))}; + public void testCmdRequestDecoderIPv6() throws UnknownHostException { + String[] hosts = {SocksCommonUtils.ipv6toStr(InetAddress.getByName("::1").getAddress())}; int[] ports = {1, 32769, 65535}; for (SocksCmdType cmdType : SocksCmdType.values()) { for (String host : hosts) { diff --git a/codec-socks/src/test/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoderTest.java b/codec-socks/src/test/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoderTest.java index 728ee1eb7a..2cc9b43db6 100755 --- a/codec-socks/src/test/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoderTest.java +++ b/codec-socks/src/test/java/io/netty/handler/codec/socksx/v5/Socks5CommandRequestDecoderTest.java @@ -20,9 +20,10 @@ import io.netty.util.NetUtil; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import org.junit.Test; -import sun.net.util.IPAddressUtil; import java.net.IDN; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.Arrays; import static org.junit.Assert.*; @@ -65,9 +66,9 @@ public class Socks5CommandRequestDecoderTest { } @Test - public void testCmdRequestDecoderIPv6() { + public void testCmdRequestDecoderIPv6() throws UnknownHostException { String[] hosts = { - NetUtil.bytesToIpAddress(IPAddressUtil.textToNumericFormatV6("::1")) }; + NetUtil.bytesToIpAddress(InetAddress.getByName("::1").getAddress()) }; int[] ports = {1, 32769, 65535}; for (Socks5CommandType cmdType: Arrays.asList(Socks5CommandType.BIND, Socks5CommandType.CONNECT,