connect method
Opens a new connection.
Throws an IndiConnectionException if the server can't be reached
within timeout.
Implementation
@override
Future<IndiConnection> connect({Duration? timeout}) async {
_connectAttempts++;
if (connectDelay > Duration.zero) await Future<void>.delayed(connectDelay);
if (refuseConnections) {
throw const IndiConnectionException(
'Cannot connect to memory://indi (refused)',
);
}
final (client, server) = InMemoryConnection.pair();
onConnect(server);
return client;
}