OSS TanbouSign in with GitHub

mock dependent APIs, inspect traffic, and inject failures through one listening port

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
4,980
Primary language
Java
License
Apache-2.0
Repository last updated
Oct 4, 2026
On this page

Overview

MockServer is a server and proxy for replacing services that an application depends on during development and testing. It defines expected requests and responses, records or changes live traffic, injects latency and connection failures, and verifies received requests in one environment.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Mock several protocols on one port

It detects HTTP/1.1, HTTPS, HTTP/2, gRPC, gRPC-Web, WebSocket, and TCP traffic from the opening bytes. Expectations can match methods, paths, headers, cookies, and bodies before returning configured responses.

Sources: [1]

Record, alter, and deliberately disrupt traffic

Proxy modes can record traffic and inspect or modify requests and responses. Fault actions inject latency, slow or dropped connections, and errors, while the dashboard displays requests, expectations, and logs.

Sources: [1]

Best fit

Fits integration tests for unavailable dependencies and recovery paths

Use it in local development or CI to replace unfinished APIs, hard-to-reproduce external services, and failure states. The project also supports expectations generated from OpenAPI and clients for Java, JavaScript, Python, and Ruby.

Sources: [1]

Before adoption

Run only in a trusted development or test environment

The official security policy says not to use MockServer in production or expose it to an untrusted network. Expectations, the control API, forwarding targets, and captured traffic may contain sensitive data or dangerous actions, so restrict access to developers and test systems. Running release 8.0.0 from a JAR or source requires Java 17 or newer; the official Docker image includes its runtime.

Sources: [2][1]

Official sources

  1. [1]MockServer 8.0.0 README(2026-10-04)
  2. [2]MockServer 8.0.0 security policy(2026-10-04)
  3. [3]MockServer 8.0.0 release(2026-10-04)
  4. [4]MockServer 8.0.0 license(2026-10-04)
Supplemental curator note

Its value extends beyond happy-path stubs: the same test environment can reproduce latency and connection failures. Because it exposes a control API, use it only on a test network that untrusted clients cannot reach.

Try it in 3 steps

  1. 1

    Pull the reviewed Docker image

    On a development machine with Docker, pin the official image to release 8.0.0.

    docker pull mockserver/mockserver:mockserver-8.0.0
  2. 2

    Start it on the loopback interface

    Keep the control API off external interfaces and listen on localhost port 1080.

    docker run -d --rm --name mockserver-demo -p 127.0.0.1:1080:1080 mockserver/mockserver:mockserver-8.0.0
  3. 3

    Wait for startup and verify a response

    Retry connection refusals for at most 60 seconds, then check GET /hello. The subshell stops the container after success or failure without leaving its trap in the caller's shell.

    ( trap 'docker stop mockserver-demo >/dev/null 2>&1 || true' EXIT; curl -fsS --retry 20 --retry-delay 1 --retry-connrefused --retry-max-time 60 --max-time 5 -X PUT http://127.0.0.1:1080/mockserver/expectation -H 'Content-Type: application/json' -d '{"httpRequest":{"method":"GET","path":"/hello"},"httpResponse":{"statusCode":200,"body":"Hello World"}}' && test "$(curl -fsS --max-time 5 http://127.0.0.1:1080/hello)" = "Hello World" )
Check the official README

Growth

Growth trends · Last 30 days

4,980 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
772
Open PRs
0

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • mock-server
  • proxy
  • java-client
  • javascript-client
  • node-module
  • node-client
  • ruby-client
  • homebrew
  • grunt-plugin
  • ai
  • chaos-engineering
  • llm
Stars
4,980
Forks
1,116
Watchers
120
Open issues
0
Contributors
109
Owner type
Organization
Primary language
Java
License
Apache-2.0
Repository last updated
Oct 4, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?