MockWebServer
MockWebServer is a free, open-source test library for developers checking HTTP, HTTPS, or HTTP/2 clients.
What MockWebServer is
MockWebServer is a free, open-source test library for developers checking HTTP, HTTPS, or HTTP/2 clients. It provides a scriptable web server where tests can supply responses and inspect requests made by an app. Recorded requests expose details such as method, path, HTTP version, body, headers, and chunk sizes. Responses can be queued in order or selected by a Dispatcher. Tests can throttle mock responses to simulate slow connections, and socket policies can keep a connection open, disconnect during a request or response body, or send no response. The README includes Java and Kotlin examples. The documented test dependency is com.squareup.okhttp3:mockwebserver3:5.5.0, available through Maven Central. Project documentation describes using it to test apps that use OkHttp. The library is licensed under Apache License, Version 2.0. The project describes its scope as internal and basic client testing, says it is not a full-featured standalone HTTP testing library, and notes that it is not actively developed for new features. MockServer is suggested when needs exceed that scope.
Good
- Tests HTTP, HTTPS, and HTTP/2 clients
- Supports queued responses and Dispatcher policies
- Can simulate throttled and interrupted connections
- Apache License 2.0
Watch out
- Not intended as a full-featured standalone testing library
- Not actively developed for new features
Who it suits
It suits developers writing internal or basic tests for apps that use OkHttp. Java and Kotlin test examples are provided.
Verdict
MockWebServer provides request inspection and response control for basic client tests. If your requirements exceed its stated scope, the project suggests MockServer.
Plans and prices
From MockWebServer's own pricing page, checked 7 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| MockWebServer | Free | No price stated · Test library for HTTP, HTTPS, and HTTP/2 clients · Available from Maven Central |
| Open source | Free | Apache License 2.0 |
The facts
Each one read from MockWebServer's own pages, with the date it was checked.
What it does
- Alternative
- The project documentation suggests MockServer for users whose needs outgrow MockWebServer.checked 4 Oct 2026
- Distribution
- The documented dependency is testImplementation("com.squareup.okhttp3:mockwebserver3:5.5.0"), available through Maven Central.checked 7 Oct 2026
- Installation
- The README lists the test dependency as com.squareup.okhttp3:mockwebserver3:5.5.0.checked 4 Oct 2026
- Integrations
- Optional artifacts provide JUnit 4 and JUnit 5 integrations, while the core mockwebserver3 module has no JUnit dependency.checked 7 Oct 2026
- Intended audience
- The project describes MockWebServer as being used for internal testing and basic testing of apps using the OkHttp client.checked 7 Oct 2026
- License
- The project page includes the Apache License, Version 2.0.checked 7 Oct 2026
- Protocols
- OkHttp describes MockWebServer as a library for testing HTTP, HTTPS, and HTTP/2 clients.checked 4 Oct 2026
- Purpose
- MockWebServer is a library for testing HTTP, HTTPS, and HTTP/2 clients.checked 7 Oct 2026
- Request capture
- Its API exposes recorded requests, including request method, target, version, body, and chunk sizes.checked 7 Oct 2026
- Request verification
- Recorded requests can be checked by method, path, HTTP version, body, and headers.checked 4 Oct 2026
- Responses
- It is a scriptable web server that replays supplied canned responses in sequence when requested.checked 7 Oct 2026
- Response scripting
- Responses can be queued in order or generated by a Dispatcher that applies a policy to each request.checked 4 Oct 2026
- Scope limit
- The project says MockWebServer is not a full featured standalone HTTP testing library and is not actively developed for new features.checked 7 Oct 2026
- Security
- The docs state that MockWebServer can test HTTP, HTTPS, and HTTP/2 clients; they do not state security certifications or compliance claims.checked 7 Oct 2026
- Simulated network conditions
- Mock responses can be throttled to simulate a slow network for timeout and interactive testing.checked 4 Oct 2026
- Socket behavior
- Socket policies include behaviors such as keeping a socket open, disconnecting during a request or response body, and sending no response.checked 7 Oct 2026
- Support
- The project directs users to report issues encountered on GraalVM, but does not state a MockWebServer support plan or response time.checked 7 Oct 2026
- Test coverage
- It lets developers specify responses and verify requests made by an app during HTTP and HTTPS calls.checked 4 Oct 2026
- Test languages
- The README provides example tests in both Java and Kotlin.checked 4 Oct 2026
Alternatives to MockWebServer
- 1
Mockzilla
Free planOpen sourceWebAPILinuxmacOS8.1From $10 a month - 2

Beeceptor
Free planWebAPILinuxmacOS7.9From $10 a month - 3
Mockfly
Free planWebAPIExtensionLinux7.4From €150 a year - 4

Microcks
Free planWebAPIExtensionLinux7.2Free plan - 5
MockAPI
Free planWebAPI7.2From $35 a year - 6
Knockout API
Free planWebAPI7.0From $10 a month
