Skip to content

rift-java

Official Java SDK for Rift — a high-performance, Mountebank-compatible HTTP/HTTPS mock server written in Rust.

One client, three transports — embedded (in-process, no Docker), connect (any running Rift admin endpoint), and spawn (a managed rift binary) — with the full engine surface on each: stubs, predicates, responses, response cycling, behaviors, proxy record/playback, fault injection, stateful scenarios, spaces/flow-state, request verification, a server-side event stream, and TLS-MITM intercept.

import static io.github.achirdlabs.rift.dsl.RiftDsl.*;

try (Rift rift = Rift.embedded()) {
    Imposter users = rift.create(
        imposter("users").record()
            .stub(onGet("/api/users/1").willReturn(okJson("{\"id\":1}"))));

    // point your SUT at users.uri(), then:
    users.verify(onGet("/api/users/1"), times(1));
}

Guides

  • Intercept (TLS-MITM) — terminate TLS for real hostnames and serve/forward/redirect.
  • JUnit 5@RiftTest, imposter and intercept injection, reset semantics.
  • TestcontainersRiftContainer for a Dockerized engine.
  • Record & replay — capture live traffic into replayable stubs.

Reference

See the README on GitHub for installation (Maven / Gradle, release and snapshot channels) and module layout.