Background:

Testing real SDK failures (dropped WebSocket, failed reconnects, bad location fetch) previously required network proxies, or manual throwing of exceptions or returning failures — all slow, inconsistent

Proposal

A in-app way to force any SDK failure path at runtime, instantly, without touching source code or external tooling. Each failure key can be toggled independently. It defaults to a no-op in production so there is zero risk in release builds.

How it works

Three pieces:

  1. FailureKey — enum of every injectable failure point.-
  2. FailureInjector — interface: enable, disable, setEnabled, isEnabled, clear, throwDebugFault, sendFailResult.
  3. NoOpFailureInjector — default implementation; isEnabled always returns false, all other methods do nothing.

At each guarded site in the SDK the pattern is the same:


if (failureInjector.isEnabled(FailureKey.FAIL_X)) {
    return failureInjector.sendFailResult(FailureKey.FAIL_X)  // or throwDebugFault
}
// normal path continues

Guarded failure points

Key File Mechanism
FAIL_JOIN_CALL Call.kt sendFailResult
FAIL_LOCATION StreamVideoClient.kt sendFailResult
FAIL_WS_CONNECT SfuSocket.kt throwDebugFault
FAIL_FAST_RECONNECT SfuSocket.kt throwDebugFault
FAIL_FULL_REJOIN SfuSocket.kt throwDebugFault
FAIL_MIGRATE SfuSocket.kt throwDebugFault

There are others. You can find it on the PR [add link here]

The UI

image.png

image.png