HTTP Mock Server
Latest stable Based on Bluetape4k release 1.11.0
Problem
Section titled “Problem”A self-contained Spring Boot 4 + Virtual Threads HTTP mock server that replaces external HTTP dependencies in integration tests. This manual connects that purpose to the current build, source entry points, tests, configuration resources, and lifecycle evidence instead of duplicating the README feature list.
When to use
Section titled “When to use”Use bluetape4k-mock-web-server when the application needs fixture ownership, isolation, deterministic cleanup, and failure diagnostics. Start with the source entry points below and confirm that their ownership and failure contracts match the calling component. Prefer a smaller standard-library or already-adopted module when it satisfies the same contract without another runtime boundary.
Coordinates
Section titled “Coordinates”dependencies { implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>")) implementation("io.github.bluetape4k:bluetape4k-mock-web-server")}Gradle project path: :bluetape4k-mock-web-server. Source directory: testing/mock-web-server.
Concepts
Section titled “Concepts”The first source-level concepts to inspect are MockServerApplication, AdminController, PingController, GlobalExceptionHandler, HttpsConfiguration, HttpbinAdvancedController, HttpbinController, and HttpbinStreamController. File names are navigation anchors; read each declaration and its tests before treating it as a public contract.
Quick start
Section titled “Quick start”Add the coordinate above, refresh Gradle, and start from the smallest entry point that owns the required task. Open MockServerApplication first; it is a concrete source entry point for the module.
API by task
Section titled “API by task”| Entry point | What to verify |
|---|---|
MockServerApplication | Inspect this declaration’s constructors, functions, and ownership contract. |
AdminController | Inspect this declaration’s constructors, functions, and ownership contract. |
PingController | Inspect this declaration’s constructors, functions, and ownership contract. |
GlobalExceptionHandler | Inspect this declaration’s constructors, functions, and ownership contract. |
HttpsConfiguration | Inspect this declaration’s constructors, functions, and ownership contract. |
HttpbinAdvancedController | Inspect this declaration’s constructors, functions, and ownership contract. |
HttpbinController | Inspect this declaration’s constructors, functions, and ownership contract. |
HttpbinStreamController | Inspect this declaration’s constructors, functions, and ownership contract. |
HttpbinSupport | Inspect this declaration’s constructors, functions, and ownership contract. |
ImageLoaderService | Inspect this declaration’s constructors, functions, and ownership contract. |
Patterns
Section titled “Patterns”The README evidence is organized around Architecture, Diagrams, Request Routing Overview, Class Diagram, Sequence Diagram — httpbin GET, Features, Configuration, Examples, Run via Docker, and Build Docker image with Jib. Use those topics as a navigation map, then confirm behavior in source and tests. Keep adoption narrow and connect owned resources to the caller lifecycle.
Integrations
Section titled “Integrations”The current build declares these integration edges:
implementation(platform(libs.spring.boot.dependencies))implementation(platform(libs.jackson3.bom))implementation("org.springframework.boot:spring-boot-starter-web")implementation("org.springframework.boot:spring-boot-starter-cache")implementation(libs.caffeine)implementation(libs.jackson3.module.kotlin)implementation(project(":bluetape4k-core"))implementation(project(":bluetape4k-logging"))implementation(project(":bluetape4k-jackson3"))Treat compileOnly edges as caller-provided capabilities and verify runtime availability before using their APIs.
Configuration
Section titled “Configuration”Configuration resources found in the module:
application.ymllocalhost.p12rootCA.pemalbums.jsoncomments.jsonphotos.jsonposts.jsontodos.json
Read property names and defaults from these resources and the binding source before overriding them.
Failures
Section titled “Failures”Failure semantics are defined by the linked entry points and tests, not inferred from the artifact name. Keep cancellation and timeout signals intact, close owned resources, and translate backend exceptions only at a boundary that can add a stable domain contract. Use the test anchors below to verify the exact behavior before adding retries or fallbacks.
Operations
Section titled “Operations”Keep fixtures isolated, bound resource use, expose diagnostics, and close shared services deterministically. Keep capacity, timeout, retry, and shutdown settings next to the component that owns the resource; avoid process-wide defaults that hide which caller accepted the trade-off.
Testing
Section titled “Testing”Run the module test task:
./gradlew :bluetape4k-mock-web-server:test --no-configuration-cacheRepresentative test anchors:
MockServerTestBaseReadmeHttpsPortContractTestAdminResetContractTestPingContractTestHttpbinAdvancedContractTestHttpbinContractTestHttpbinStreamContractTestHttpbinSupportTest
Workshops
Section titled “Workshops”No dedicated workshop path is registered in the manual manifest. Use the module README and the representative tests above as runnable evidence.
Limitations
Section titled “Limitations”This page documents the repository state represented by the linked source and tests. It does not turn optional backends into application defaults or claim performance without a benchmark artifact. Re-check compatibility and lifecycle notes when the module version changes.
Release diagrams
Section titled “Release diagrams”These diagrams are loaded directly from README assets published with the 1.11.0 release and pinned to its immutable commit. They describe this manual’s released structure and runtime flows, not later Snapshot changes. Select a preview to open the SVG at the same release commit.
Mock Web Server routing overview
Section titled “Mock Web Server routing overview”Release README: testing/mock-web-server/README.md
Mock Web Server class structure
Section titled “Mock Web Server class structure”Release README: testing/mock-web-server/README.md
httpbin GET request sequence
Section titled “httpbin GET request sequence”Release README: testing/mock-web-server/README.md


