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.
Official sources
- [1]MockServer 8.0.0 README(2026-10-04)
- [2]MockServer 8.0.0 security policy(2026-10-04)
- [3]MockServer 8.0.0 release(2026-10-04)
- [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
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
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
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" )
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
Categories
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
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- OpenAPI Generator26,771 Stars
1 shared tag(s) · 1 shared category(s) · Same language
Generate client SDKs, server stubs, documentation, and configuration for many languages from one OpenAPI contract
Java - Mockito15,454 Stars
1 shared tag(s) · 1 shared category(s) · Same language
replace Java collaborators and keep unit tests focused
Java - GraphQL Java6,220 Stars
1 shared tag(s) · 1 shared category(s) · Same language
implement the GraphQL specification on the JVM with composable schema, execution, and instrumentation APIs
Java - Apache ActiveMQ Classic2,464 Stars
1 shared tag(s) · 1 shared category(s) · Same language
self-host enterprise messaging with a Java broker supporting JMS, AMQP, MQTT, STOMP, and WebSocket transports
Java - WireMock7,387 Stars
2 shared tag(s) · 2 shared category(s) · Same language
Virtualize HTTP APIs with request matching, dynamic responses, delays/faults, and record/playback in a mock server or library
Java - REST Assured7,140 Stars
2 shared tag(s) · 2 shared category(s) · Same language
test REST APIs from Java with a DSL for requests, status, headers, and JSON/XML assertions
Java
Report incorrect information
Tell us if any listing information is incorrect or outdated.