Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

MockServer Examples

A single, consistent home for runnable MockServer examples across every language and interface. Whatever client you use, start here.

How this is organised

Examples are grouped by language/interface at the top level, with two cross-cutting topic folders (chaos/, wasm/) that apply regardless of client:

Folder What it covers
java/ Java client + proxy examples (a buildable, CI-tested Maven module)
node/ Node.js / TypeScript client examples
python/ Python client examples
ruby/ Ruby client examples
go/ Go client examples (including interactive breakpoints)
dotnet/ .NET / C# client examples (including interactive breakpoints)
rust/ Rust client examples (including interactive breakpoints)
php/ PHP client examples (REST-only; static forward overrides)
curl/ Raw REST control-plane examples as runnable curl scripts (+ original reference markdown)
json/ Expectation & initializer JSON payloads (+ original reference markdown)
docker-compose/ Deployment scenarios: ports, env vars, mTLS, persistence, expectation initialiser
wasm/ Custom WASM body-matcher rules — rust/ (prebuilt) and go/
chaos/ Fault injection across HTTP, TCP, gRPC and LLM layers — MockServer's flagship differentiator

Consistency rule

Every leaf example is self-contained and identical in shape:

  • one runnable entrypoint (script / program), and
  • a short README.md with exactly these sections: What it demonstrates · Prerequisites · Run · Expected output.

Each top-level folder has its own index README.md linking its examples. If you add an example, follow this shape.

Prerequisites

Most examples assume a running MockServer. Quickest start:

# Docker
docker run -d --rm -p 1080:1080 mockserver/mockserver

# or the standalone jar
java -jar mockserver-netty-<version>-shaded.jar -serverPort 1080

Scripts default to http://localhost:1080; the curl/, json/, and chaos/ scripts honour a MOCKSERVER_URL env var (e.g. export MOCKSERVER_URL=http://localhost:1080). Each language track's README explains how to install that client (npm / pip / gem / Maven).

Relationship to the documentation

These examples are intended to stay in lock-step with behaviour: the java/ module is built in CI (so it can't silently rot), and the docker-compose/ scenarios are reused by container_integration_tests/.