Documentation
¶
Overview ¶
Package testpeer provides a scripted raw WebSocket peer for NT4 client tests. It deliberately does not import the production codec or implement NT state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Peer ¶
type Peer struct {
Server *httptest.Server
Frames chan Frame
Connections chan *websocket.Conn
UpgradeGate <-chan struct{} // set before dialing to hold the HTTP upgrade
UpgradeEntered chan struct{} // optional buffered notification before the gate
PingObserved chan struct{} // optional buffered notification, with replies disabled
Disconnected chan struct{} // buffered notification when a peer socket exits
Protocol string // empty means no subprotocol selected
// contains filtered or unexported fields
}
Peer accepts one connection at a time and lets a test script read/write raw frames. Frames is bounded; if the test stops draining it the socket read blocks, allowing deterministic writer pressure without an unbounded buffer.
Click to show internal directories.
Click to hide internal directories.