private ProxyType getProxyType(String proxyType) { if (proxyType.equalsIgnoreCase("http")) { return ProxyType.HTTP; } else if (proxyType.equalsIgnoreCase("socks4")) { return ProxyType.SOCKS4; } else if (proxyType.equalsIgnoreCase("socks5")) { return ProxyType.SOCKS5; } return ProxyType.NONE; }
/** * Get the save proxy configuration. * * @return the proxy configuration */ private ProxyInfo getProxyConfiguration() { boolean useProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false); if (useProxy) { String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP"); String phost = mSettings.getString(BeemApplication.PROXY_SERVER_KEY, ""); String puser = mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, ""); String ppass = mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, ""); int pport = Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, "1080")); ProxyInfo.ProxyType type = ProxyType.valueOf(stype); return new ProxyInfo(type, phost, pport, puser, ppass); } else { return ProxyInfo.forNoProxy(); } }