org.mule.tck
Class PortUtils

java.lang.Object
  extended by org.mule.tck.PortUtils

public class PortUtils
extends Object

Utility class to find available ports.


Constructor Summary
PortUtils()
           
 
Method Summary
static void checkPorts(boolean failIfTaken, String prefix, List<Integer> ports)
          Iterate through the ports and log whether each is available
static List<Integer> findFreePorts(int numberOfPorts)
          Find a given number of available ports
static boolean isPortFree(int port)
          Check and log is a given port is available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortUtils

public PortUtils()
Method Detail

findFreePorts

public static List<Integer> findFreePorts(int numberOfPorts)
Find a given number of available ports

Parameters:
numberOfPorts - The number of free ports to find
Returns:
an List with the number of requested ports

checkPorts

public static void checkPorts(boolean failIfTaken,
                              String prefix,
                              List<Integer> ports)
                       throws Exception
Iterate through the ports and log whether each is available

Parameters:
failIfTaken - If true, fails the current test if the port is not available
Throws:
Exception

isPortFree

public static boolean isPortFree(int port)
Check and log is a given port is available

Parameters:
port - the port number to check
Returns:
true if the port is available, false otherwise


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.