mockwebserver / okhttp3.mockwebserver / MockWebServer / start

start

fun start(): Unit

Equivalent to start(0).

fun start(port: Int): Unit

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

Parameters

port - Int: 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 - InetAddress!: the address to create the server socket on

port - Int: 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.