mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
添加ping和isOpen的测试用例
This commit is contained in:
parent
d7afb728f0
commit
f971cfc3a3
@ -8,6 +8,7 @@ import org.junit.Test;
|
||||
|
||||
import java.net.HttpCookie;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -79,4 +80,16 @@ public class NetUtilTest {
|
||||
public void getLocalHostNameTest() {
|
||||
Assert.assertNotNull(NetUtil.getLocalHostName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pingTest(){
|
||||
Assert.assertTrue(NetUtil.ping("127.0.0.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isOpenTest(){
|
||||
InetSocketAddress address = new InetSocketAddress("www.hutool.cn", 443);
|
||||
Assert.assertTrue(NetUtil.isOpen(address, 200));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user