com.github.mlk.junit.rules.Helper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assortmentofjunitrules Show documentation
Show all versions of assortmentofjunitrules Show documentation
Useful assortment of JUnit rules for integration testing
package com.github.mlk.junit.rules;
import java.io.IOException;
import java.net.ServerSocket;
public class Helper {
private Helper() {
}
public static int findRandomOpenPortOnAllLocalInterfaces() throws IOException {
try (ServerSocket socket = new ServerSocket(0)) {
return socket.getLocalPort();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy