Class SimulatorConfig

java.lang.Object
com.soklet.SimulatorConfig

@ThreadSafe public final class SimulatorConfig extends Object
Opaque, single-use execution configuration consumed by one SokletSimulator run attempt.

Each builder() and withSokletConfig(SokletConfig) owns a fresh set of off-network transports. A successful SimulatorConfig.Builder.build() seals that transport graph, and SokletSimulator.run(SimulatorConfig, SokletSimulator.Simulation) atomically claims the completed configuration before lifecycle work begins. Sequential or concurrent reuse is rejected. Create a new configuration for each simulation run.

Instances are thread-safe, but deliberately stateful: claiming a run is an irreversible operation. The configuration intentionally exposes no public accessors; configured transports are available from the run's Simulator.

  • Method Details

    • builder

      Creates a builder backed by a fresh off-network transport graph.
      Returns:
      a fresh simulator-configuration builder
    • withSokletConfig

      Creates a builder by importing the application settings and transport shape of an existing Soklet configuration.

      The returned builder owns a fresh off-network counterpart for each HTTP, SSE, or MCP transport present in the source; it never reuses or changes the source configuration's transport instances. Every transport present in the source remains present in the imported shape. Use builder() instead when a test must omit one. Explicitly configured application collaborators are reused by identity, while unset defaults that depend on the completed configuration are derived again for the simulator configuration. MCP collaborators such as admission controllers, interceptors, localizers, rate limiters, the task manager, and its task-event publisher are also reused by identity; stateful ones can be replaced through SimulatorConfig.Builder.configureMcpServer(Consumer). Later calls on the returned builder override imported settings.

      Derivation is transport-isolated, not a deep copy of the application object graph. A dependency-injection provider or other collaborator that captured a source transport is not inspected or rebound and continues to reference that source object. Supply test-scoped collaborators explicitly when that distinction matters.

      An imported MCP server is reconstructed from its original build settings. Runtime control-plane changes made after that server was built, such as key rotation or localization invalidation, are deliberately not copied. HTTP and SSE streaming lifecycle capacity, callback concurrency, and cleanup timeout are copied from Soklet's built-in servers. The SSE connection queue capacity is also copied. Custom transports use the simulator's defaults.

      Parameters:
      sokletConfig - source application configuration
      Returns:
      a fresh, transport-isolated simulator-configuration builder
    • fromSokletConfig

      Creates a completed, single-use simulator configuration from an existing Soklet configuration.

      This is equivalent to withSokletConfig(sokletConfig).build(). Each invocation creates a fresh off-network transport graph, so the source configuration may be used to derive any number of transport-isolated simulator configurations. Application and MCP collaborators are still shared by identity as described by withSokletConfig(SokletConfig).

      Parameters:
      sokletConfig - source application configuration
      Returns:
      a fresh, completed, transport-isolated simulator configuration