Skip to content

UTS: Add RTN15a proxy test variant for TCP close without WebSocket close frame #464

@paddybyers

Description

@paddybyers

Context

The existing RTN15a proxy integration test in connection_resume.md verifies that an unexpected transport disconnect triggers resume. It uses the proxy's close action, which sends a WebSocket close frame before closing the TCP connection.

An analogous test case should be added for the scenario where the TCP connection is closed without a WebSocket close frame (using the proxy's disconnect action). This verifies that the SDK detects the TCP FIN and transitions to disconnected promptly — the same behavior as the close-frame case.

Investigation in ably-js (on branch uts-integration-proxy) confirmed that the Node.js ws library detects a raw TCP FIN immediately and fires its close event, so the SDK transitions to disconnected with the same minimal delay as when a close frame is sent. This is distinct from a silent connection loss (no TCP close at all), which is only detected after the idle timer fires (~25s).

Proposed addition

Add a new test to uts/realtime/integration/proxy/connection_resume.md as a variant of the existing RTN15a test (Test 6). The test is identical except the proxy rule uses "action": { "type": "disconnect" } instead of "action": { "type": "close" }.

Proposed test spec

## Test 6b: RTN15a - Unexpected disconnect triggers resume (TCP close without close frame)

| Spec | Requirement |
|------|-------------|
| RTN15a | If transport is disconnected unexpectedly, attempt resume |

Same as Test 6, but the proxy closes the underlying TCP connection without
sending a WebSocket close frame. The SDK should detect the TCP FIN and
transition to disconnected with minimal delay — identical to the close-frame
case.

### Setup

**Proxy rules:** Close the underlying TCP connection (no WebSocket close
frame) after a 1-second delay.

session = create_proxy_session(
  endpoint: "sandbox",
  port: port_base + N,
  rules: [
    {
      match: { type: "delay_after_ws_connect", delayMs: 1000 },
      action: { type: "disconnect" },
      times: 1,
      comment: "RTN15a: Close TCP (no close frame) after 1s to trigger unexpected disconnect"
    }
  ]
)

**SDK config:** Same as Test 6.

### Test Steps

Same as Test 6.

### Assertions

Same as Test 6.

Implementation

An ably-js implementation of this test already exists on the uts-integration-proxy branch.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions