health method
Pings both the proxy and target URLs to verify connectivity.
Returns true if the proxy responds with a 2xx status.
Implementation
Future<bool> health() async {
try {
final uri = Uri.parse(_config.proxyUrl);
final req = await _client!.headUrl(uri);
final resp = await req.close();
await resp.drain<void>();
return resp.statusCode >= 200 && resp.statusCode < 300;
} catch (_) {
return false;
}
}