mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
add TCPPingerTest to see it's results on a macOS
This commit is contained in:
parent
12b21ed955
commit
2430a28a1c
27
test/net/azib/ipscan/core/net/TCPPingerTest.java
Normal file
27
test/net/azib/ipscan/core/net/TCPPingerTest.java
Normal file
@ -0,0 +1,27 @@
|
||||
package net.azib.ipscan.core.net;
|
||||
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TCPPingerTest {
|
||||
Pinger pinger = new TCPPinger(10);
|
||||
|
||||
@Test
|
||||
public void pingAlive() throws IOException {
|
||||
PingResult result = pinger.ping(new ScanningSubject(InetAddress.getLocalHost()), 3);
|
||||
assertTrue(result.isAlive());
|
||||
assertTrue(result.getAverageTime() <= 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pingDead() throws IOException {
|
||||
PingResult result = pinger.ping(new ScanningSubject(InetAddress.getByName("192.168.99.253")), 1);
|
||||
assertFalse(result.isAlive());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user