API mocking with latency simulation

Data as of Oct 21, 2026Reviewed by

How we measure

AI summary

has a clear lead for realistic API mocking that simulates latency and error states.

It depends

For a single-developer project, is another option, with fine-grained latency controls at the environment and route levels.

leads this topic, but leads Chaos Engineering & API Mocking Tools overall.

Which brands AI mentions

#BrandMentioned in

Complex simulations with templating, stateful behavior, and hosted or local options.

Fine-grained latency controls for individual developers’ mock environments and routes.

Presented as a platform to explore, without a specific testing use.

=3Postman42%

Mentioned in · Jul 5 – Oct 21, 2026

ChatGPT SearchChatGPT SearchGoogle AI ModeGoogle AI Mode

Widest split: Mockoon, 86% on ChatGPT Search and 75% on Google AI Mode.

  • 1WireMockChatGPT Search 95%Google AI Mode 100%
  • 2MockoonChatGPT Search 86%Google AI Mode 75%
  • =3BeeceptorChatGPT Search 38%Google AI Mode 48%
  • =3MSW (Mock Service Worker)ChatGPT Search 48%Google AI Mode 38%
  • =3PostmanChatGPT Search 47%Google AI Mode 38%

Questions and answers

  • Google AI ModeOct 21, 2026

    1. 1WireMock
    2. 2Hoverfly
    3. 3ToxiProxy

    Yes, several powerful tools let you mock API responses with custom delays and failure conditions to test system resilience. Popular options include WireMock, Prymock, Hoverfly, Mountebank , and Toxiproxy (which works at the TCP network layer rather than HTTP).

    Top API Mocking and Resilience Tools

    • WireMock : A flexible tool for stubbing and recording HTTP responses. It lets you set fixed or random delays and return custom error status codes (like 500 or 503) to test timeout handling and error recovery. You can run it via Java, Docker, or standalone.
    • Toxiproxy : A proxy designed for testing network conditions. Instead of mocking the API content, it injects latency, bandwidth limits, and connection cuts directly into TCP connections. It works well alongside real or mocked backends.
    • Hoverfly : A lightweight and fast API simulation tool. It allows you to capture real traffic and replay it with simulated latency, or design failure scenarios using its middleware support.
    • Mountebank : A cross-platform tool for multi-protocol test doubles. It supports HTTP, TCP, and SMTP, letting you script complex response behaviors, inject injection delays, and simulate flaky network behaviors.

    Would you like to see a quick configuration example for one of these tools, or do you need recommendations based on a specific test environment (like CI/CD pipelines vs. local development)?

    ChatGPT SearchOct 21, 2026

    1. 1WireMock
    2. 2MockServer
    3. 3ToxiProxy
    4. 4Hoverfly

    Yes — there are several tools specifically designed to mock API responses with configurable latency, errors, timeouts, and other failure conditions. They're useful for resilience testing, including retry logic, circuit breakers, graceful degradation, and handling slow or unavailable dependencies.

    The best choice depends on whether you want to simulate failures locally during development, run automated integration tests in CI/CD, or inject faults into a running distributed system.

    Tools worth considering

    • Automated API Testing with WireMock Server: A Hands-on Example | by Anderson Kuntz Meurer | Medium

    1. WireMock

    (Best general-purpose choice)

    A flexible HTTP mock server for local development, automated tests, and CI pipelines. Supports fixed and randomized delays, HTTP error codes, empty responses, malformed data, and connection resets.

    Best for: Testing retry policies, timeout handling, fallback responses, and application behavior under slow or failing APIs.

    Official site ·


    • MockServer UI | MockServer

    2. MockServer

    A strong option when you need precise, programmable failure scenarios. It supports fixed or random latency, configurable error rates, connection drops, malformed responses, and fault injection against proxied upstream traffic.

    Best for: Integration tests and controlled experiments against mocked or real downstream services.

    Official site ·


    • Chaos in the network — using ToxiProxy for network chaos engineering | by Safeer CM | The Cloud Bulletin | Medium

    3. Toxiproxy

    Unlike a traditional API mock, Toxiproxy sits between your application and a real dependency. It can introduce latency and jitter, restrict bandwidth, drop packets, time out connections, and simulate connection resets.

    Best for: Testing how your application behaves when the network or a real downstream service becomes unreliable.

    GitHub and documentation


    • Keploy Documentation

    4. Hoverfly

    Provides API simulation, traffic capture and replay, and configurable delays, errors, and rate limits. It can replace external dependencies with reusable simulations.

    Best for: Replaying realistic API traffic and testing integrations without repeatedly calling external services.

    Open-source project


    • Introducing Mountebank

    5. Mountebank

    Supports HTTP, HTTPS, and TCP imposters, with delayed responses and fault conditions such as connection resets or corrupted data.

    Best for: Teams that need service virtualization across several protocols, not just REST APIs.

    Fault simulation documentation

    Quick comparison

    CapabilityWireMockMockServerToxiproxyHoverfly
    Return custom JSONYesYesNo — network proxyYes
    Fixed latencyYesYesYesYes
    Randomized latencyYesYesLatency + jitterConfigurable
    HTTP 500/503 responsesYesYesNot its primary purposeYes
    Connection drops/resetsYesYesYesFault simulation
    Proxy real dependenciesYes, conditionallyYesYesYes
    Best fitAPI-level testsProgrammable fault testsNetwork failuresTraffic replay

    Sources: WireMock, MockServer, Toxiproxy, Hoverfly.

    Example: simulate a slow or failing API

    With WireMock, you can configure a mocked endpoint to return a successful JSON response after a two-second delay:

    json
    {
      "request": {
        "method": "GET",
        "url": "/api/orders"
      },
      "response": {
        "status": 200,
        "fixedDelayMilliseconds": 2000,
        "headers": {
          "Content-Type": "application/json"
        },
        "jsonBody": {
          "orders": []
        }
      }
    }

    You can then create separate scenarios for:

    • Slow response: 2-second or randomized delay.
    • Transient failure: HTTP 503 on selected requests, followed by HTTP 200.
    • Timeout: Delay beyond your client's configured timeout.
    • Network failure: Reset the connection instead of returning an HTTP response.
    • Rate limiting: Return HTTP 429 with a Retry-After header.

    WireMock supports response delays and low-level HTTP fault simulation; connection-level failures may require a fault configuration rather than an ordinary status response.

    My recommendation

    Start with WireMock if you want a straightforward way to define API responses and latency in automated tests. Choose MockServer if you want more programmable, probabilistic fault injection, or Toxiproxy if you need to test network behavior against real services.

    One question that would help narrow this down: What environment are you testing?

    1. Testing environment

    Local development

    Integration tests / CI pipeline

    Staging or distributed system

    Production-like chaos testing


    2. Protocol

    REST / HTTP

    gRPC

    TCP / database connections

    Multiple protocols


    3. Deployment preference

    Self-hosted / open source

    Hosted / managed

    Either

    [Find the best fit]

  • Google AI ModeOct 19, 2026

    1. 1WireMock
    2. 2MockServer
    3. 3Mockoon
    4. 4ToxiProxy

    Mocking API endpoints for resilience testing (such as testing circuit breakers, retries, timeouts, and fallback states) requires a tool capable of fault injection —specifically, artificial latency and HTTP error codes.

    Top Tools for API Fault Injection

    • WireMock : Excellent for programmatic and code-driven testing (Java, JUnit, or standalone server/Docker). It supports fixed or random delays and specific HTTP status faults.
    • MockServer : Powerful for both standalone mocking and acting as a proxy to inject latency, connection drops, and error codes (500, 503, 429) deterministically or probabilistically.
    • Mockoon : A lightweight, user-friendly desktop and CLI tool great for visually setting up latency and rule-based response status codes per route.
    • Toxiproxy : A TCP proxy specifically built for chaos and resilience testing. Instead of mocking the HTTP layer, it sits between your app and the real database/API to manipulate network conditions (latency, bandwidth limitation, toxic connection drops).

    Implementation Examples

    1. Using WireMock (JSON Stub / Code)

    You can configure a delayed response and an error code using WireMock's mapping configuration:

    2. Using MockServer (Chaos Profile / Fault Injection)

    MockServer allows you to attach a declarative profile to simulate dropped connections or percentage-based failures:

    Recommended Best Practices

    1. Test Incrementally: Start with deterministic single-error triggers (e.g., a hard 500 or a 5s timeout) to ensure your basic error-handling and fallback logic execute properly.
    2. Introduce Probabilistic Failure: Progress to injecting intermittent failures (e.g., 10% packet loss or random 429 Rate Limit responses) to test complex client retry storms and jitter algorithms.
    3. Validate Recovery: Ensure your application properly recovers and closes circuit breakers once the mock endpoint returns to a healthy 200 OK state with zero latency.

    If you'd like to dive deeper, let me know:

    • What language or framework your application is written in
    • Which specific scenario you are trying to test (e.g., timeout handling, exponential backoff, or circuit breaking)

    I can provide a tailored configuration for your exact tool stack.

    ChatGPT SearchOct 19, 2026

    1. 1WireMock
    2. 2MockServer
    3. 3ToxiProxy

    The most reliable way to mock API endpoints for resilience testing is to use a dedicated mock server that lets you control HTTP error responses, response latency, timeouts, and connection failures. Then run your application or integration tests against those controlled failures and verify that retries, circuit breakers, fallbacks, and timeout handling work as expected.

    1. Choose a fault-injection tool

    • Automated API Testing with WireMock Server: A Hands-on Example | by Anderson Kuntz Meurer | Medium

    WireMock

    (Best starting point)

    Mock specific endpoints and configure HTTP status codes, fixed or randomized delays, and malformed responses or connection resets. Good for repeatable API integration tests and CI pipelines.

    Docs: Simulating faults ·


    • MockServer

    MockServer

    Useful for more advanced scenarios, including configurable error rates, response delays, malformed responses, and dropped connections.

    Docs:


    • Chaos in the network — using ToxiProxy for network chaos engineering | by Safeer CM | The Cloud Bulletin | Medium

    Toxiproxy

    Best when you need to simulate network-level problems rather than just return an HTTP error: latency, jitter, bandwidth restrictions, dropped traffic, and connection resets.

    Docs:

    WireMock is a strong first choice if you primarily test HTTP APIs. Toxiproxy complements it when you need to reproduce failures at the network layer.

    2. Configure endpoints with specific failures

    With WireMock, you can define mappings as JSON files or register them through its admin API. For example, the following mappings simulate a server error and a slow successful response.

    json
    
    [
      {
        "request": {
          "method": "GET",
          "url": "/api/orders/500"
        },
        "response": {
          "status": 500,
          "jsonBody": {
            "error": "INTERNAL_SERVER_ERROR",
            "message": "Simulated server failure"
          },
          "headers": {
            "Content-Type": "application/json"
          }
        }
      },
      {
        "request": {
          "method": "GET",
          "url": "/api/orders/slow"
        },
        "response": {
          "status": 200,
          "fixedDelayMilliseconds": 3000,
          "jsonBody": {
            "id": "order-123",
            "status": "processing"
          },
          "headers": {
            "Content-Type": "application/json"
          }
        }
      },
      {
        "request": {
          "method": "GET",
          "url": "/api/orders/unavailable"
        },
        "response": {
          "status": 503,
          "jsonBody": {
            "error": "SERVICE_UNAVAILABLE"
          }
        }
      }
    ]

    These examples configure three distinct scenarios:

    • /api/orders/500: HTTP 500 Internal Server Error.
    • /api/orders/slow: HTTP 200 after a three-second delay.
    • /api/orders/unavailable: HTTP 503 Service Unavailable.

    Save the mappings in your WireMock mappings directory or register them using its admin API. Point your application's test configuration at the mock server instead of the real dependency.

    3. Build a resilience test matrix

    Start with a defined set of failure scenarios so you can reproduce failures and verify the expected behavior.

    ScenarioMock behaviorWhat to verify
    Server errorHTTP 500Retry policy and error handling
    Rate limitingHTTP 429Backoff and Retry-After handling
    Dependency unavailableHTTP 503Fallback behavior
    Slow response2–5 second delayClient timeouts and loading states
    Request timeoutDelay exceeds client deadlineCancellation and graceful degradation
    Connection resetTerminate the connectionRetry logic and connection recovery
    Intermittent failureFail some requests, succeed othersRecovery after retries
    Malformed responseInvalid or truncated JSONValidation and safe error handling

    WireMock supports fixed and randomized delays as well as several connection and malformed-response faults. For actual network timeouts and connection disruptions, Toxiproxy is another useful option.

    4. Test realistic response-time distributions

    A fixed delay is useful for deterministic tests, but production systems often experience variable latency.

    Consider testing these profiles:

    Normal latency

    50–150 ms with small amounts of jitter. Establish baseline behavior.


    Elevated latency

    500–1,500 ms. Verify deadlines, responsiveness, and retry budgets.


    Long-tail latency

    Occasional 3–10 second responses. Verify timeouts, cancellation, and fallback paths.

    These are example test values, not universal production thresholds. WireMock supports uniform and log-normal delay distributions for introducing jitter and long-tail latency.

    5. Automate the tests in your CI pipeline

    A useful test loop looks like this:

    1. Start mock server

    Load endpoint mappings and fault scenarios

    2. Inject a failure

    500, 503, latency, timeout, or connection reset

    3. Execute application tests

    Assert retries, fallback responses, and recovery

    4. Collect results and clean up

    Check error rates, latency, logs, and leaked resources

    A few important practices:

    • Make failure scenarios deterministic for ordinary CI tests; use randomized chaos experiments separately.
    • Test that retries have limits and exponential backoff, so failures do not amplify load.
    • Check that circuit breakers open during sustained failures and recover afterward.
    • Set explicit timeouts and a total retry budget.
    • Keep fault injection confined to test environments, and reset mock state between tests.

    6. Tailor the setup to your stack

    I can provide a working example with the mock configuration, test code, and commands to run it. Which environment are you using?

    Your application stack

    Node.js / Jest

    Python / pytest

    Java / Spring Boot

    .NET / xUnit

    Go

    Other


    Which failure modes do you need?


    What are you testing?

    An HTTP API or microservice

    A frontend consuming an API

    A database or external dependency

    [Generate my test setup]

  • Google AI ModeOct 5, 2026

    1. 1Mockoon
    2. 2MockServer
    3. 3WireMock
    4. 4Beeceptor

    To thoroughly validate your application's failure handling, timeouts, and resilience, you need an API mocking tool that supports fault injection (latency, random/deterministic HTTP errors, and connection drops).

    Here are the top tools that handle configurable network lag and error states exceptionally well, categorized by how you intend to run them:

    1. Mockoon (Open Source / Desktop)

    • Overview: A fantastic, lightweight desktop application (and CLI) that lets you quickly spin up mock APIs with a visual UI.
    • Lag & Error Features: You can configure a global or route-specific delay (in milliseconds) for network lag. You can also specify response status codes (e.g., 500, 503, 404) and define rules to trigger errors conditionally based on headers, query params, or body content.
    • Get started: Download or explore documentation on the Mockoon Official Website.

    2. MockServer (Open Source / Self-Hosted & Docker)

    • Overview: A robust, developer-focused tool built specifically for robust integration testing, unit testing, and chaos engineering.
    • Lag & Error Features: Offers advanced Chaos Testing profiles. You can configure probabilistic or deterministic fault injection—including artificial latency (delays), explicit HTTP error statuses (500, 429, etc.), and hard TCP connection drops to test connection resets. It can act as a local mock server or a proxy sitting in front of real upstream dependencies.
    • Get started: Check out the setup guides on MockServer Docs.

    3. WireMock (Open Source / Cloud / Java or Standalone)

    • Overview: The industry gold standard for mocking in JVM environments, available as a standalone binary, Docker container, or managed cloud service.
    • Lag & Error Features: WireMock allows fine-grained response tuning. You can set fixed or random uniform/log-normal delays ("fixedDelayMilliseconds": 2000 ) and return fault responses like empty responses, garbled bytes, or connection interruptions alongside standard HTTP error codes.
    • Get started: Explore configuration options at WireMock.org.

    4. Beeceptor (Cloud / SaaS)

    • Overview: A hosted, easy-to-use mocking solution that requires zero local installation.
    • Lag & Error Features: Allows you to define custom rules where you can inject response latency (delaying the response by a set number of seconds) and force specific HTTP status codes or custom payloads on the fly.
    • Get started: Test it out directly via Beeceptor.

    To help narrow down the best fit, tell me:

    • Do you prefer a local desktop app/GUI (like Mockoon), a code/Docker-based tool (like WireMock or MockServer), or a cloud-hosted mock (like Beeceptor)?
    • Are you planning to run these tests locally on your machine or inside a CI/CD pipeline?

    ChatGPT SearchOct 5, 2026

    1. 1WireMock
    2. 2Mockoon
    3. 3Mockzilla

    WireMock is probably the strongest fit. It supports configurable fixed/random latency, HTTP error responses, connection resets, malformed responses, and slow/chunked responses—excellent for resilience and timeout testing.

    Other good options:

    • Mockoon — very approachable GUI; supports simulated latency plus multiple/rule-driven responses and error status codes.
    • Mockzilla — specifically offers configurable latency and per-service/endpoint error rates.
    • WireMock Cloud — useful if you want shared/team simulations and configurable failure/latency scenarios without managing infrastructure.

    My pick: WireMock for automated integration tests; Mockoon for quickly experimenting locally. WireMock docs Mockoon

  • ChatGPT SearchOct 2, 2026

    1. 1WireMock
    2. 2Mockoon
    3. 3MSW (Mock Service Worker)

    WireMock is the strongest fit for highly realistic API simulation. It supports fixed and randomized latency, long-tail latency distributions, chunked responses, HTTP errors, connection faults, stateful behavior, record/playback, and dynamic responses.

    ServiceLatency simulationError/fault simulationRealism
    WireMock / WireMock CloudExcellentExcellentExcellent
    MockoonExcellentGoodExcellent
    MountebankGoodExcellentVery good
    MSWCode-drivenCode-drivenGood

    For example, WireMock can model a log-normal latency distribution rather than simply sleeping for a fixed number of milliseconds—useful for reproducing realistic long-tail network behavior.

    WireMock is my recommendation if realistic failure/latency behavior is the primary requirement.

    Google AI ModeOct 2, 2026

    1. 1WireMock
    2. 2Mockoon
    3. 3MSW (Mock Service Worker)
    4. 4Postman

    When looking for the best, most realistic API mocking capabilities—specifically for advanced network condition simulation like latency and deep error state injection—the developer community generally points to a few top contenders depending on whether you need a local development mock, a standalone server, or enterprise service virtualization.

    • WireMock / WireMock Cloud : Widely considered the gold standard for robust API simulation. It goes far beyond simple status code returns by supporting fixed, random, and chunked delays, bandwidth throttling, and advanced fault injection (such as dropping connections midway, sending garbage data, or resetting sockets). It supports stateful behavior and dynamic response templating via Handlebars.
    • Mockoon : The best open-source desktop application for quick, highly visual mock API creation. It makes adding granular per-route or global latency, random response times, and specific HTTP error codes (like 500, 503, or custom payloads) remarkably frictionless without writing configuration files.
    • MSW (Mock Service Worker) : If your definition of "realistic" means intercepting requests at the network level inside the browser or Node.js test environment (without spinning up an external server), MSW is unmatched for frontend development. It allows you to use standard async/await delays (ctx.delay() ) and standard network error throws right inside your service worker layer.
    • Postman Mock Servers : Excellent for teams already embedded in the Postman ecosystem. It allows you to generate mock endpoints straight from a collection or OpenAPI spec with basic configurable delays, though it is less granular for chaotic network faults or advanced stateful scripting compared to WireMock.

    To help narrow down the ideal tool for your stack, let me know:

    • Are you mocking APIs for frontend development (browser/SPA), backend integration testing , or an E2E automated pipeline?
    • Do you prefer a local UI/desktop app , an in-code library , or a hosted cloud service?

Also asked as

  • What's a good API mocking tool that can generate realistic data and simulate network latency?