public static void checkRemoteServer() { if (Config.getInstance().getHykProxyClientLocalProxy() != null || !Config.getInstance().getClient2ServerConnectionMode().equals(ConnectionMode.HTTP2GAE)) { return; } if (logger.isDebugEnabled()) { logger.debug("Start check remote server reachable."); } List<HykProxyServerAuth> auths = Config.getInstance().getHykProxyServerAuths(); if (auths.isEmpty()) { auths = new LinkedList<Config.HykProxyServerAuth>(); HykProxyServerAuth master = new HykProxyServerAuth(); master.appid = Constants.MASTER_APPID; auths.add(master); } for (HykProxyServerAuth auth : auths) { if (!ClientUtils.isHttpServerReachable(auth.appid, false)) { if (ClientUtils.isHttpServerReachable(auth.appid, true)) { Preferences.setPrefernceValue(DEFAULT_GOOGLE_PROXY_TYPE, OVER_HTTP + ""); } else { Preferences.setPrefernceValue(DEFAULT_GOOGLE_PROXY_TYPE, OVER_HTTPS + ""); logger.error("Can NOT reach remote appengine server:" + auth.appid); } return; } else { break; } } Preferences.setPrefernceValue(DEFAULT_GOOGLE_PROXY_TYPE, DIRECT + ""); }
public static int selectDefaultGoogleProxy() { String value = Preferences.getPreferenceValue(DEFAULT_GOOGLE_PROXY_TYPE); int intValue = OVER_HTTPS; if (null != value) { intValue = Integer.parseInt(value); } switch (intValue) { case OVER_HTTP: { if (setDefaultGoogleHttpProxy()) { return OVER_HTTP; } break; } case OVER_HTTPS: { if (setDefaultGoogleHttpsProxy()) { return OVER_HTTPS; } break; } default: break; } return DIRECT; }