mockwebserver / okhttp3.mockwebserver / MockWebServer / start

start

@JvmOverloads fun start(port: Int = 0): Unit

Starts the server on the loopback interface for the given port.

Parameters

port - the port to listen to, or 0 for any available port. Automated tests should always use port 0 to avoid flakiness when a specific port is unavailable.

fun start(inetAddress: InetAddress, port: Int): Unit

Starts the server on the given address and port.

Parameters

inetAddress - the address to create the server socket on

port - the port to listen to, or 0 for any available port. Automated tests should always use port 0 to avoid flakiness when a specific port is unavailable.