Sunday, October 25, 2026 4,350 lists 78,100 records on file
List your app or device

  1. Home
  2. API Mocking Tools
  3. MockWebServer

MockWebServer

What it is

MockWebServer is a free, open-source library for developers testing apps that make HTTP, HTTPS, or HTTP/2 requests. Tests can supply responses and inspect requests made by an app, including method, path, HTTP version, body, headers, and chunk sizes. Responses can be queued in order or selected by a Dispatcher applying a policy to each request. Throttling can imitate slow network conditions for timeout and interactive testing. Socket policies can keep a connection open, disconnect during a request or response body, or send no response. The README includes Java and Kotlin test examples. Its documented test dependency is com.squareup.okhttp3:mockwebserver3:5.5.0, available through Maven Central, and the project describes its use for testing apps that use OkHttp. It is licensed under Apache License, Version 2.0. The project positions it for internal and basic client testing, not as a full-featured standalone HTTP testing library, and says it is not actively developed for new features. MockServer is suggested when testing needs exceed its scope.

For and against

For

  • Tests HTTP, HTTPS, and HTTP/2 clients.
  • Responses can be queued or generated by a Dispatcher.
  • Can simulate throttling and socket behaviors.
  • Java and Kotlin test examples are provided.

Against

  • Not a full-featured standalone HTTP testing library.
  • Not actively developed for new features.
  • Project describes its scope as internal and basic testing.

The verdict

MockWebServer offers request inspection and scripted responses for basic client tests. Developers whose needs exceed that stated scope can consider the project's suggested alternative, MockServer.

Who it suits

It suits developers who need internal or basic tests for apps using the OkHttp client. Its response scripting and request capture can help verify client behavior across supported HTTP protocols.

Plans and prices

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

Every plan, in full

On the record

Alternative
The project documentation suggests MockServer for users whose needs outgrow MockWebServer.github.com · read 4 Oct 2026
Distribution
The documented dependency is testImplementation("com.squareup.okhttp3:mockwebserver3:5.5.0"), available through Maven Central.lysine.dev · read 7 Oct 2026
Installation
The README lists the test dependency as com.squareup.okhttp3:mockwebserver3:5.5.0.github.com · read 4 Oct 2026
Integrations
Optional artifacts provide JUnit 4 and JUnit 5 integrations, while the core mockwebserver3 module has no JUnit dependency.lysine.dev · read 7 Oct 2026
Intended audience
The project describes MockWebServer as being used for internal testing and basic testing of apps using the OkHttp client.lysine.dev · read 7 Oct 2026
License
The project page includes the Apache License, Version 2.0.lysine.dev · read 7 Oct 2026
Protocols
OkHttp describes MockWebServer as a library for testing HTTP, HTTPS, and HTTP/2 clients.github.com · read 4 Oct 2026
Purpose
MockWebServer is a library for testing HTTP, HTTPS, and HTTP/2 clients.lysine.dev · read 7 Oct 2026
Request capture
Its API exposes recorded requests, including request method, target, version, body, and chunk sizes.lysine.dev · read 7 Oct 2026
Request verification
Recorded requests can be checked by method, path, HTTP version, body, and headers.github.com · read 4 Oct 2026
Responses
It is a scriptable web server that replays supplied canned responses in sequence when requested.lysine.dev · read 7 Oct 2026
Response scripting
Responses can be queued in order or generated by a Dispatcher that applies a policy to each request.github.com · read 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.lysine.dev · read 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.lysine.dev · read 7 Oct 2026
Simulated network conditions
Mock responses can be throttled to simulate a slow network for timeout and interactive testing.github.com · read 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.square.github.io · read 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.lysine.dev · read 7 Oct 2026
Test coverage
It lets developers specify responses and verify requests made by an app during HTTP and HTTPS calls.github.com · read 4 Oct 2026

The review

MockWebServer is a scriptable test server for developers checking how HTTP clients behave. It suits teams testing apps built with OkHttp that need to inspect requests and control responses; it is a focused basic-testing tool, not a general-purpose HTTP testing library.

Overview

MockWebServer can exercise HTTP, HTTPS, and HTTP/2 clients by replaying supplied responses and exposing requests for inspection. Its narrow scope is a strength for straightforward OkHttp tests, but the project says it is intended for internal and basic client testing, not as a full-featured standalone testing library, and is not actively developed for new features.

Key features

Request inspection and response control

Tests can check recorded requests by method, path, HTTP version, body, and headers; the API also exposes chunk sizes. That makes it practical to verify what an app actually sent, rather than only whether a call returned a response. Responses can be queued in sequence or generated by a Dispatcher applying a policy to each request. Path matching and dynamic responses support tests that need different outcomes for different requests.

Network and socket behavior

Throttled mock responses let developers simulate slow connections for timeout and interactive testing. Socket policies can keep a connection open, disconnect during a request or response body, or send no response. These controls help cover failure and waiting behavior without turning the library into a broader service-testing platform.

Setup and compatibility

The documented test dependency is testImplementation("com.squareup.okhttp3:mockwebserver3:5.5.0"), available through Maven Central. README examples are provided in Java and Kotlin, and the project documents use with apps that use OkHttp. The library is licensed under Apache License, Version 2.0.

Pricing

MockWebServer is free and open source, with no paid tier or stated usage quota. The Open source plan costs free under Apache License 2.0. The MockWebServer plan also costs free and provides the test library for HTTP, HTTPS, and HTTP/2 clients through Maven Central. Neither plan has a stated seat cap or trial term; the distinction is not a paid-versus-limited feature ladder.

Platforms

MockWebServer is categorized for Android. Its documented use is as a test library for clients, especially apps using OkHttp; it is not positioned as a hosted mock API service.

Who it's for

Choose MockWebServer when you need a free, local test dependency to inspect requests and script responses for an OkHttp-based app. Its request capture, protocol coverage, and socket controls are useful for focused client tests. Look elsewhere if you need a full-featured standalone HTTP testing library, broader development of new features, or a service intended to support use beyond internal and basic client testing.

Pros and cons

  • Pros: Free under Apache 2.0, with no stated quota, making it suitable for repeatable client tests without a paid plan.
  • Pros: Request details and ordered or policy-driven responses let tests check both what an app sends and how it handles replies.
  • Pros: HTTP, HTTPS, HTTP/2, throttling, and socket policies cover several useful client behaviors, including timeouts and disconnects.
  • Cons: The project limits its intended use to internal and basic client testing, so it is a poor fit as a full standalone HTTP testing solution.
  • Cons: It is not actively developed for new features, which matters to teams seeking an evolving testing platform.

Alternatives

The project suggests API Mocking Tools as a category to explore. For needs beyond MockWebServer's basic client-testing scope, MockServer is the project's suggested alternative.

Parasoft SOAtest is worth considering if a paid product with a free trial and tailored, quote-based pricing better fits your requirements. Knockout API offers a freemium option across API and web platforms, with a free plan capped at 30 images per month. Microcks is another free, open-source option, described as a community-driven CNCF Incubating project.

Mockfly has a free Starter plan capped at 500 requests a day, one project, four endpoints, and two responses per endpoint; choose it if those stated limits suit your needs. Mockzilla offers a free tier with 1K requests per month, 5 requests per second, one simulation, and 10 MB of data transfer. Beeceptor may suit readers seeking a paid individual plan with a free trial; its $10 a month plan includes 15,000 requests per month per endpoint and up to 50 mock rules.

MockAPI offers a free plan limited to one project and two resources, with paid monthly and annual options for 20 projects and 50 resources. Mockttp is free for hobbyist use, including basic traffic viewing and rewriting, manual breakpoints, and a built-in HTTP client.

Verdict

MockWebServer is a sound choice for developers who need a free, focused way to test HTTP clients in OkHttp-based apps. Its strongest case is the combination of request inspection, scripted responses, and useful network and socket controls; its narrow basic-testing remit and lack of active feature development are clear reasons to look elsewhere when requirements extend beyond that.

Alternatives to MockWebServer

Every alternative, ranked