Class EphemeralPorts

java.lang.Object
org.terracotta.utilities.test.net.EphemeralPorts

public class EphemeralPorts extends Object
  • Field Details

  • Constructor Details

    • EphemeralPorts

      public EphemeralPorts()
  • Method Details

    • getRange

      public static EphemeralPorts.Range getRange()
    • findRange

      private static EphemeralPorts.Range findRange()
    • firstLine

      private static String firstLine(String... cmd) throws IOException
      Execute a command and return the first response line.
      Parameters:
      cmd - the command to execute
      Returns:
      the first response line
      Throws:
      IndexOutOfBoundsException - if the command response is empty
      IOException - if an error is encountered while executing the command
    • allLines

      private static Iterable<String> allLines(String... cmd) throws IOException
      Execute a command and return an Iterable with all response lines.
      Parameters:
      cmd - the command to execute
      Returns:
      an Iterable over all response lines
      Throws:
      IOException - if an error is encountered while executing the command
    • asProperties

      private static Properties asProperties(String... cmd) throws IOException
      Execute a command and return a Properties instance composed from the output.
      Parameters:
      cmd - the command to execute
      Returns:
      a new Properties instance
      Throws:
      IOException - if an error is encountered while executing the command or loading the Properties instance
    • main

      public static void main(String[] args)