public void scanInterrupted() throws Exception {
// these ports are unlikely to be open :-)
config.portString = "65530-65535";
fetcher.init();
Object value = fetcher.scan(new ScanningSubject(InetAddress.getLocalHost()));
assertNull(value);
// reasonably long timeout (if tests fails, we will have to wait this long...)
config.portTimeout = 3000;
// but we don't want to wait :-)
Thread.currentThread().interrupt();
long testStartTime = System.currentTimeMillis();
// this host is unlikely to respond
value = fetcher.scan(new ScanningSubject(InetAddress.getByName("10.255.255.254")));
assertNull(value);
assertTrue("port scanning wasn't interrupted", System.currentTimeMillis() - testStartTime < 3000);
// reset interrupted flag
assertTrue(Thread.interrupted());