dropPeer method

void dropPeer()

Simulates the peer dropping the link. Mirrors real backends, which close both the state and incoming streams on a peer-initiated disconnect.

Implementation

void dropPeer() {
  if (_closed) return;
  _closed = true;
  _current = ConnectionState.disconnected;
  _state.add(ConnectionState.disconnected);
  if (!_state.isClosed) unawaited(_state.close());
  if (!_incoming.isClosed) unawaited(_incoming.close());
}