Package org.apache.camel.k.test
Class AvailablePortFinder
- java.lang.Object
-
- org.apache.camel.k.test.AvailablePortFinder
-
public final class AvailablePortFinder extends Object
Finds currently available server ports.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getNextAvailable()
Gets the next available port.static Map<String,Integer>
reserveNetworkPorts(String... names)
Reserve a list of random and not in use network ports and place them in Map.static <T> Map<String,T>
reserveNetworkPorts(Function<Integer,T> converter, String... names)
Reserve a list of random and not in use network ports and place them in Map.
-
-
-
Method Detail
-
getNextAvailable
public static int getNextAvailable()
Gets the next available port.- Returns:
- the available port
- Throws:
IllegalStateException
- if there are no ports available
-
reserveNetworkPorts
public static Map<String,Integer> reserveNetworkPorts(String... names)
Reserve a list of random and not in use network ports and place them in Map.
-
-