Package org.opendaylight.protocol.util
Class InetSocketAddressUtil
- java.lang.Object
-
- org.opendaylight.protocol.util.InetSocketAddressUtil
-
public final class InetSocketAddressUtil extends Object
Created as a util for test tools.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InetSocketAddress
getInetSocketAddress(String hostPortString, Integer defaultPort)
static InetSocketAddress
getRandomLoopbackInetSocketAddress()
static InetSocketAddress
getRandomLoopbackInetSocketAddress(int port)
static String
getRandomLoopbackIpAddress()
Generate a random loopback ip address.static int
getRandomPort()
Generate a random high range port number.static List<InetSocketAddress>
parseAddresses(String address)
static List<InetSocketAddress>
parseAddresses(String address, int defaultPort)
static com.google.common.net.HostAndPort
toHostAndPort(InetSocketAddress address)
-
-
-
Method Detail
-
parseAddresses
public static List<InetSocketAddress> parseAddresses(String address, int defaultPort)
-
parseAddresses
public static List<InetSocketAddress> parseAddresses(String address)
-
toHostAndPort
public static com.google.common.net.HostAndPort toHostAndPort(InetSocketAddress address)
-
getInetSocketAddress
public static InetSocketAddress getInetSocketAddress(String hostPortString, Integer defaultPort)
-
getRandomLoopbackInetSocketAddress
public static InetSocketAddress getRandomLoopbackInetSocketAddress(int port)
-
getRandomLoopbackInetSocketAddress
public static InetSocketAddress getRandomLoopbackInetSocketAddress()
-
getRandomPort
public static int getRandomPort()
Generate a random high range port number.- Returns:
- A port number range from 20000 to 60000
-
getRandomLoopbackIpAddress
public static String getRandomLoopbackIpAddress()
Generate a random loopback ip address. IP address range: 127.50.50.50 ~ 127.250.250.250 We did not utilize the whole 127./8 range to avoid using common addresses like 127.0.0.1- Returns:
- Generated random loopback IP address
-
-