injectError method
Simulates a connection failure by emitting error to the incoming
stream, as a real transport would on socket error.
Implementation
void injectError(Object error, [StackTrace? stackTrace]) {
if (_closed) {
return;
}
_connected = false;
_incoming.addError(error, stackTrace ?? StackTrace.current);
}