BAEL-5714 : Port Scanning with Java (edit after final review) (#12824)
This commit is contained in:
parent
b95b09c274
commit
78c64f6815
@ -15,7 +15,7 @@ public class PortScanner {
|
|||||||
private static final int poolSize = 10;
|
private static final int poolSize = 10;
|
||||||
private static final int timeOut = 200;
|
private static final int timeOut = 200;
|
||||||
|
|
||||||
public void runPortScan(String ip, int nbrPortMaxToScan) throws IOException, RuntimeException {
|
public void runPortScan(String ip, int nbrPortMaxToScan) throws IOException {
|
||||||
ConcurrentLinkedQueue openPorts = new ConcurrentLinkedQueue<>();
|
ConcurrentLinkedQueue openPorts = new ConcurrentLinkedQueue<>();
|
||||||
ExecutorService executorService = Executors.newFixedThreadPool(poolSize);
|
ExecutorService executorService = Executors.newFixedThreadPool(poolSize);
|
||||||
AtomicInteger port = new AtomicInteger(0);
|
AtomicInteger port = new AtomicInteger(0);
|
||||||
|
@ -11,7 +11,7 @@ class PortScannerUnitTest {
|
|||||||
private static final String ip = "127.0.0.1";
|
private static final String ip = "127.0.0.1";
|
||||||
PortScanner portScanner = new PortScanner();
|
PortScanner portScanner = new PortScanner();
|
||||||
|
|
||||||
@Test public void when_Run_then_lunchPortScan() throws IOException, RuntimeException {
|
@Test public void when_Run_then_lunchPortScan() throws IOException {
|
||||||
portScanner.runPortScan(ip, nbrPortMax);
|
portScanner.runPortScan(ip, nbrPortMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user