Static method to check whether the port provided is available to connect to.
Uses ServerSocket for this check.
ServerSocket trialSocket = null;
try
{
trialSocket = new ServerSocket(port);
}
catch(IOException ioe)
{
String msg = localizedStrMgr.getString( "admin.common.port_in_use", new String( port + "" ) );
throw new PortInUseException( msg );
}
finally
{
try
{
if (trialSocket != null)
{
trialSocket.close();
}
}
catch(Exception e)
{
Debug.printStackTrace(e);
}
}