]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/helpers/ProxyHelper.java
Fix a crash in View Source when using a proxy. https://redmine.stoutner.com/issues/725
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / helpers / ProxyHelper.java
index f30d71a8f42ba4f184ffcd8ba2c54564f42c60c2..04e40e9b4dad4ef85fa5625b38079bc4001812c0 100644 (file)
@@ -250,13 +250,13 @@ public class ProxyHelper {
             case (ProxyHelper.TOR):
                 if (Build.VERSION.SDK_INT >= 21) {
                     // Use localhost port 9050 as the socket address.
             case (ProxyHelper.TOR):
                 if (Build.VERSION.SDK_INT >= 21) {
                     // Use localhost port 9050 as the socket address.
-                    SocketAddress torSocketAddress = new InetSocketAddress("localhost", 9050);
+                    SocketAddress torSocketAddress = InetSocketAddress.createUnresolved("localhost", 9050);
 
                     // Create a SOCKS proxy.
                     proxy = new Proxy(Proxy.Type.SOCKS, torSocketAddress);
                 } else {
                     // Use localhost port 8118 as the socket address.
 
                     // Create a SOCKS proxy.
                     proxy = new Proxy(Proxy.Type.SOCKS, torSocketAddress);
                 } else {
                     // Use localhost port 8118 as the socket address.
-                    SocketAddress oldTorSocketAddress = new InetSocketAddress("localhost", 8118);
+                    SocketAddress oldTorSocketAddress = InetSocketAddress.createUnresolved("localhost", 8118);
 
                     // Create an HTTP proxy.
                     proxy = new Proxy(Proxy.Type.HTTP, oldTorSocketAddress);
 
                     // Create an HTTP proxy.
                     proxy = new Proxy(Proxy.Type.HTTP, oldTorSocketAddress);
@@ -265,7 +265,7 @@ public class ProxyHelper {
 
             case (ProxyHelper.I2P):
                 // Use localhost port 4444 as the socket address.
 
             case (ProxyHelper.I2P):
                 // Use localhost port 4444 as the socket address.
-                SocketAddress i2pSocketAddress = new InetSocketAddress("localhost", 4444);
+                SocketAddress i2pSocketAddress = InetSocketAddress.createUnresolved("localhost", 4444);
 
                 // Create an HTTP proxy.
                 proxy = new Proxy(Proxy.Type.HTTP, i2pSocketAddress);
 
                 // Create an HTTP proxy.
                 proxy = new Proxy(Proxy.Type.HTTP, i2pSocketAddress);
@@ -284,7 +284,7 @@ public class ProxyHelper {
                     Uri customProxyUri = Uri.parse(customProxyUrlString);
 
                     // Get the custom socket address.
                     Uri customProxyUri = Uri.parse(customProxyUrlString);
 
                     // Get the custom socket address.
-                    SocketAddress customSocketAddress = new InetSocketAddress(customProxyUri.getHost(), customProxyUri.getPort());
+                    SocketAddress customSocketAddress = InetSocketAddress.createUnresolved(customProxyUri.getHost(), customProxyUri.getPort());
 
                     // Get the custom proxy scheme.
                     String customProxyScheme = customProxyUri.getScheme();
 
                     // Get the custom proxy scheme.
                     String customProxyScheme = customProxyUri.getScheme();