Package org.apache.pekko.testkit
Class SocketUtil
java.lang.Object
org.apache.pekko.testkit.SocketUtil
Utilities to get free socket address.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InetSocketAddressstatic InetSocketAddressnotBoundServerAddress(String address) static Stringstatic inttemporaryLocalPort(boolean udp) static inttemporaryLocalPort(SocketUtil.Protocol protocol) Find a free local post on 'localhost' that is available on the given protocol If both UDP and TCP need to be free specifyBothstatic booleanstatic InetSocketAddresstemporaryServerAddress(String address, boolean udp) static Stringstatic booleanstatic scala.collection.immutable.IndexedSeq<InetSocketAddress>temporaryServerAddresses(int numberOfAddresses, String hostname, boolean udp) static Stringstatic booleantemporaryServerHostnameAndPort(String interface_) static Stringstatic int
-
Constructor Details
-
SocketUtil
public SocketUtil()
-
-
Method Details
-
RANDOM_LOOPBACK_ADDRESS
-
temporaryLocalPort
public static int temporaryLocalPort(boolean udp) - Returns:
- A port on 'localhost' that is currently available
-
temporaryLocalPort
Find a free local post on 'localhost' that is available on the given protocol If both UDP and TCP need to be free specifyBoth -
temporaryLocalPort$default$1
public static boolean temporaryLocalPort$default$1() -
temporaryServerAddress
- Parameters:
address- host address. If not set, a loopback IP from the 127.20.0.0/16 range is pickedudp- if true, select a port that is free for running a UDP server. Otherwise TCP.- Returns:
- an address (host+port) that is currently available to bind on
-
temporaryServerAddress$default$1
-
temporaryServerAddress$default$2
public static boolean temporaryServerAddress$default$2() -
temporaryServerAddresses
public static scala.collection.immutable.IndexedSeq<InetSocketAddress> temporaryServerAddresses(int numberOfAddresses, String hostname, boolean udp) -
temporaryServerAddresses$default$2
-
temporaryServerAddresses$default$3
public static boolean temporaryServerAddresses$default$3() -
temporaryServerHostnameAndPort
-
temporaryServerHostnameAndPort$default$1
-
temporaryUdpIpv6Port
-
notBoundServerAddress
-
notBoundServerAddress
-