Class IPAddress


  • public class IPAddress
    extends Object
    • Constructor Detail

      • IPAddress

        public IPAddress()
    • Method Detail

      • findSiteLocalAddress

        public static String findSiteLocalAddress()
        Tries to determine a site local (10.0.0.0, 172.16.0.0 or 192.168.0.0) IP address of the machine the test is running on.
        Returns:
        An IP address of one of the network interfaces in the machine or an empty optional
        Throws:
        RuntimeException - if no IP was found
      • findIPAddress

        public static Optional<String> findIPAddress​(Function<InetAddress,​Boolean> acceptor)
        Enumerates the available IP addresses until one is found which is accepted by the given function.
        Parameters:
        acceptor - the function which determines if an IP address should be returned or not
        Returns:
        An IP address of one of the network interfaces in the machine or an empty optional.