Package akka.testkit
Class SocketUtil
- java.lang.Object
-
- akka.testkit.SocketUtil
-
public class SocketUtil extends java.lang.Object
Utilities to get free socket address.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SocketUtil.Both$
static interface
SocketUtil.Protocol
static class
SocketUtil.Tcp$
static class
SocketUtil.Udp$
-
Constructor Summary
Constructors Constructor Description SocketUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.InetSocketAddress
notBoundServerAddress()
static java.net.InetSocketAddress
notBoundServerAddress(java.lang.String address)
static java.lang.String
RANDOM_LOOPBACK_ADDRESS()
static int
temporaryLocalPort(boolean udp)
static int
temporaryLocalPort(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 specifyBoth
static boolean
temporaryLocalPort$default$1()
static java.net.InetSocketAddress
temporaryServerAddress(java.lang.String address, boolean udp)
static java.lang.String
temporaryServerAddress$default$1()
static boolean
temporaryServerAddress$default$2()
static scala.collection.immutable.IndexedSeq<java.net.InetSocketAddress>
temporaryServerAddresses(int numberOfAddresses, java.lang.String hostname, boolean udp)
static java.lang.String
temporaryServerAddresses$default$2()
static boolean
temporaryServerAddresses$default$3()
static scala.Tuple2<java.lang.String,java.lang.Object>
temporaryServerHostnameAndPort(java.lang.String interface_)
static java.lang.String
temporaryServerHostnameAndPort$default$1()
static int
temporaryUdpIpv6Port(java.net.NetworkInterface iface)
-
-
-
Method Detail
-
RANDOM_LOOPBACK_ADDRESS
public static java.lang.String RANDOM_LOOPBACK_ADDRESS()
-
temporaryLocalPort
public static int temporaryLocalPort(boolean udp)
- Returns:
- A port on 'localhost' that is currently available
-
temporaryLocalPort
public static int temporaryLocalPort(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 specifyBoth
-
temporaryLocalPort$default$1
public static boolean temporaryLocalPort$default$1()
-
temporaryServerAddress
public static java.net.InetSocketAddress temporaryServerAddress(java.lang.String address, boolean udp)
- 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
public static java.lang.String temporaryServerAddress$default$1()
-
temporaryServerAddress$default$2
public static boolean temporaryServerAddress$default$2()
-
temporaryServerAddresses
public static scala.collection.immutable.IndexedSeq<java.net.InetSocketAddress> temporaryServerAddresses(int numberOfAddresses, java.lang.String hostname, boolean udp)
-
temporaryServerAddresses$default$2
public static java.lang.String temporaryServerAddresses$default$2()
-
temporaryServerAddresses$default$3
public static boolean temporaryServerAddresses$default$3()
-
temporaryServerHostnameAndPort
public static scala.Tuple2<java.lang.String,java.lang.Object> temporaryServerHostnameAndPort(java.lang.String interface_)
-
temporaryServerHostnameAndPort$default$1
public static java.lang.String temporaryServerHostnameAndPort$default$1()
-
temporaryUdpIpv6Port
public static int temporaryUdpIpv6Port(java.net.NetworkInterface iface)
-
notBoundServerAddress
public static java.net.InetSocketAddress notBoundServerAddress(java.lang.String address)
-
notBoundServerAddress
public static java.net.InetSocketAddress notBoundServerAddress()
-
-