in commons-testing-generic/src/main/java/org/apache/commons/testing/net/AvailableServerPortFinder.java [55:75]
static {
int port = MIN_PORT_NUMBER;
ServerSocket ss = null;
while (ss == null) {
try {
ss = new ServerSocket(port);
} catch (final Exception e) {
ss = null;
port += 200;
}
}
LOCK = ss;
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
close();
}
});
currentMinPort.set(port + 1);
}