Class SokletSimulator

java.lang.Object
com.soklet.SokletSimulator

@ThreadSafe public final class SokletSimulator extends Object
Runs single-use, off-network simulation configurations.

Incomplete teardown throws SokletShutdownIncompleteException after a successful simulation body, or suppresses it on the original body failure. Its message summarizes component dispositions and residual activity; inspect SokletLifecycleException.getShutdownResult() for the frozen typed evidence. Outstanding work alone does not invent a Throwable cause.

  • Method Details

    • run

      public static <E extends @NonNull Throwable> @NonNull ShutdownResult run(@NonNull SokletConfig sokletConfig, @NonNull SokletSimulator.Simulation<@NonNull E> simulation) throws E
      Runs an existing Soklet application configuration against a fresh, off-network simulator transport graph.

      The source configuration supplies the application's settings and transport shape. Every source transport type remains present in the derived graph; use SimulatorConfig.builder() when a test must omit one. The simulator call never starts, claims, reuses, or changes the source HTTP, SSE, or MCP instances, so each invocation is transport-isolated.

      Explicitly configured application and MCP collaborators are reused by identity. Derivation does not inspect or rebind dependency-injection providers or other objects that captured a source transport. Supply test-scoped collaborators through SimulatorConfig.withSokletConfig(SokletConfig) when needed. A caller interrupt status left set by the simulation body is temporarily cleared while bounded teardown runs and is restored before this method returns or throws.

      Type Parameters:
      E - checked throwable type selected by the simulation
      Parameters:
      sokletConfig - source application configuration
      simulation - simulation work
      Returns:
      the exact immutable scope-shutdown result
      Throws:
      E - if the simulation fails; a teardown failure is then suppressed on it
      SokletShutdownIncompleteException - if successful simulation execution is followed by shutdown that cannot be proven complete
    • run

      public static <E extends @NonNull Throwable> @NonNull ShutdownResult run(@NonNull SimulatorConfig simulatorConfig, @NonNull SokletSimulator.Simulation<@NonNull E> simulation) throws E
      Runs one prebuilt, single-use off-network simulation configuration. A caller interrupt status left set by the simulation body is temporarily cleared while bounded teardown runs and is restored before this method returns or throws.
      Type Parameters:
      E - checked throwable type selected by the simulation
      Parameters:
      simulatorConfig - simulator configuration; it is claimed by this call before lifecycle work begins and cannot be reused
      simulation - simulation work
      Returns:
      the exact immutable scope-shutdown result
      Throws:
      E - if the simulation fails; a teardown failure is then suppressed on it
      SokletShutdownIncompleteException - if successful simulation execution is followed by shutdown that cannot be proven complete
      IllegalStateException - if simulatorConfig was already claimed