Skip to main content

Java

Java is fully supported by Speedscale. Use this page for Java-specific proxy settings, TLS trust configuration, demo guidance, and the Proxymock local workflow.

Demo App

  • Public demo: speedscale/demo (java directory)
  • Stack: Spring Boot
  • Local run: make local
  • Traffic generator: make client or make client-capture

This is the current public Java demo used for local Proxymock examples.

Proxymock

Use this path for the fastest Java first success on a developer workstation.

  1. 1. Install and initialize Proxymock
    brew install speedscale/tap/proxymock
    proxymock init

    Use browser sign-in by default. Use `proxymock init --api-key <your key>` only for CI or other headless environments.

  2. 2. Start recording
    git clone https://github.com/speedscale/demo
    cd demo/java
    proxymock record --app-port 8080 --out ./proxymock/recorded

    The app listens on port 8080 while proxymock records inbound traffic on 4143 and saves the capture in `./proxymock/recorded`.

  3. 3. Route Java traffic through the proxy and run the app
    cd demo/java
    export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=4140 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=4140 -Djavax.net.ssl.trustStore=${HOME}/.speedscale/certs/cacerts.jks -Djavax.net.ssl.trustStorePassword=changeit"
    make local

    This keeps the JVM on the proxy path and uses the proxymock truststore for TLS interception.

  4. 4. Generate one real workflow
    cd demo/java
    make client-capture

    Exercise the SpaceX and Treasury requests once so the exported capture reflects the real demo flow.

  5. 5. Stop the recording, then run with mocks
    cd demo/java
    proxymock mock --in ./proxymock/recorded
    make local-capture

    The mocked run should no longer need live downstream access.

  6. 6. Replay the same traffic against a change
    cd demo/java
    proxymock replay --in ./proxymock/recorded --test-against http://localhost:8080

    Use replay as the regression check before shipping Java changes.

TLS Trust

Java typically needs an explicit truststore when TLS interception is involved. See the shared Language Configuration page for the exact proxymock certs --jks command, JVM flags, and custom truststore workflow.