create

fun create(configureMapper: Consumer<ObjectMapper>): Mokksy(source)

Creates a Mokksy instance with Jackson and a custom ObjectMapper configuration, binding to "127.0.0.1" on a random port.

This overload exists so Java callers can pass a mapper callback without specifying host/port/verbose. It delegates to create with default host, port, and verbosity:

Mokksy mokksy = MokksyJackson.create(ObjectMapper::findAndRegisterModules).start();

Return

A new, not-yet-started Mokksy instance.

Parameters

configureMapper

Callback to customise the ObjectMapper used by Ktor.

Throws

if ktor-serialization-jackson is not on the runtime classpath.


fun create(host: String = DEFAULT_HOST, port: Int = 0, verbose: Boolean = false, configureMapper: Consumer<ObjectMapper> = Consumer { }): Mokksy(source)

Creates a Mokksy instance with Jackson configured for JSON content negotiation.

The server is not started automatically. Chain with Mokksy.start:

Mokksy mokksy = MokksyJackson.create().start();

Return

A new, not-yet-started Mokksy instance.

Parameters

host

Network interface to bind to. Defaults to "127.0.0.1".

port

Port to bind to. Defaults to 0 (OS-assigned ephemeral port).

verbose

Enables DEBUG-level request/response logging. Defaults to false.

configureMapper

Optional callback to customise the ObjectMapper used by Ktor, e.g. mapper -> mapper.findAndRegisterModules(). Defaults to a no-op.

Throws

if ktor-serialization-jackson is not on the runtime classpath.