diff --git a/lib/networking/http.dart b/lib/networking/http.dart index dc2ee2e8b..393b16bcd 100644 --- a/lib/networking/http.dart +++ b/lib/networking/http.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:socks5_proxy/socks_client.dart'; import 'package:stackwallet/services/tor_service.dart'; import 'package:stackwallet/utilities/logger.dart'; @@ -16,6 +17,10 @@ class Response { } class HTTP { + /// Visible for testing so we can override with a mock TorService + @visibleForTesting + TorService torService = TorService.sharedInstance; + Future get({ required Uri url, Map? headers, @@ -26,8 +31,8 @@ class HTTP { if (routeOverTor) { SocksTCPClient.assignToHttpClient(httpClient, [ ProxySettings( - TorService.sharedInstance.proxyInfo.host, - TorService.sharedInstance.proxyInfo.port, + torService.proxyInfo.host, + torService.proxyInfo.port, ), ]); } @@ -68,8 +73,8 @@ class HTTP { if (routeOverTor) { SocksTCPClient.assignToHttpClient(httpClient, [ ProxySettings( - TorService.sharedInstance.proxyInfo.host, - TorService.sharedInstance.proxyInfo.port, + torService.proxyInfo.host, + torService.proxyInfo.port, ), ]); }