corda / net.corda.testing.core / freeLocalHostAndPort


fun freeLocalHostAndPort(): NetworkHostAndPort
Deprecated: Returned port is not guaranteed to be free when used, which can result in flaky tests. Instead use a port range that's unlikely to be used by the rest of the system, such as PortAllocation.Incremental(10000).

Returns a localhost address with a free port.

Unsafe for getting multiple ports! Use getFreeLocalPorts for getting multiple ports.