Log.log(Log.LEVEL_TRACE, MODULE, "No proxy");
	public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) {		try {			GalleryProperties p = GalleryRemote._().properties;			// set proxy info			String proxyList = System.getProperty("javaplugin.proxy.config.list");			String proxyHost = null;			int proxyPort = 80;			String proxyUsername = null;			String proxyPassword = null;			if (proxyList != null && proxyList.length() != 0) {				try {					proxyList = proxyList.toUpperCase();					Log.log(Log.LEVEL_TRACE, MODULE, "Plugin Proxy Config List Property: " + proxyList);					// 6.0.0 1/14/03 1.3.1_06 appears to omit HTTP portion of reported proxy list... Mod to accomodate this...					// Expecting proxyList of "HTTP=XXX.XXX.XXX.XXX:Port" OR "XXX.XXX.XXX.XXX:Port" & assuming HTTP...					if (proxyList.indexOf("HTTP=") != -1) {						proxyHost = proxyList.substring(proxyList.indexOf("HTTP=")+5, proxyList.indexOf(":"));					} else {						proxyHost = proxyList.substring(0, proxyList.indexOf(":"));					}					int endOfPort = proxyList.indexOf(",");					if (endOfPort < 1) endOfPort = proxyList.length();					proxyPort = Integer.parseInt(proxyList.substring(proxyList.indexOf(":")+1,endOfPort));					Log.log(Log.LEVEL_TRACE, MODULE, "proxy " + proxyHost+" port " + proxyPort);				}				catch (Exception e) {					Log.log(Log.LEVEL_TRACE, MODULE, "Exception during failover auto proxy detection" );					Log.logException(Log.LEVEL_ERROR, MODULE, e);					proxyHost = null;				}			} else if (p.getBooleanProperty(USE_PROXY)) {				proxyHost = p.getProperty(PROXY_HOST);				try {					proxyPort = p.getIntProperty(PROXY_PORT);				} catch (NumberFormatException e) {				}				proxyUsername = p.getProperty(PROXY_USERNAME);				if (proxyUsername != null && proxyUsername.length() > 0) {					proxyPassword = p.getBase64Property(PROXY_PASSWORD);				}			}			if (proxyHost != null) {				Log.log(Log.LEVEL_TRACE, MODULE, "Setting proxy to " + proxyHost + ":" + proxyPort);				HTTPConnection.setProxyServer(proxyHost, proxyPort);				if (proxyUsername != null && proxyUsername.length() > 0) {					Log.log(Log.LEVEL_TRACE, MODULE, "Setting proxy auth to " + proxyUsername + ":" + proxyPassword);					AuthorizationInfo.addBasicAuthorization(proxyHost, proxyPort, "",							proxyUsername, proxyPassword);				}				// also set Java URLConnection proxy				Properties sprops = System.getProperties();				sprops.setProperty("http.proxySet", "true");				sprops.setProperty("http.proxyHost", proxyHost);				sprops.setProperty("http.proxyPort", ""+proxyPort);			} else {				HTTPConnection.setProxyServer(null, 0);			}			// create a connection			HTTPConnection mConnection = new HTTPConnection(url);			addUserInfo(mConnection, url);			String userAgent = g.getUserAgent();			if (userAgent != null) {				mConnection.setDefaultHeaders(new NVPair[] { new NVPair("User-Agent", userAgent) });			}			if (g.getType() == Gallery.TYPE_STANDALONE) {				// assemble the URL				String urlPath = url.getFile();				if (g.forceGalleryVersion == 0 || g.forceGalleryVersion == 1) {					Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2 for " + url);					// Test GalleryComm2					String urlPath2 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2.SCRIPT_NAME : "/" + GalleryComm2.SCRIPT_NAME);					if (tryComm(su, mConnection, urlPath2, null)) {						Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2");						return new GalleryComm2(g);					}				}				if (g.forceGalleryVersion == 0 || g.forceGalleryVersion == 2) {					Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2.5 for " + url);					// Test GalleryComm2					String urlPath2_5 = urlPath + ((urlPath.endsWith("/")) ? GalleryComm2_5.SCRIPT_NAME : "/" + GalleryComm2_5.SCRIPT_NAME);					StringBuffer sb = new StringBuffer();					if (tryComm(su, mConnection, urlPath2_5, sb)) {						if (sb != null && sb.indexOf("ERROR_PERMISSION_DENIED") == -1) {							Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2.5");							return new GalleryComm2_5(g);						} else {							// G2 remote module is deactivated							su.error(GRI18n.getString(MODULE, "g2.moduleDisabled"));						}					}				}				/*Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 1 for " + url);				// Test GalleryComm1				// BUT: only if first try was not status code 401 = authorization failure				String scriptName = "gallery_remote.php";				String urlPath1 = urlPath + ((urlPath.endsWith("/")) ? scriptName : "/" + scriptName);				if (lastRespCode != 401 && tryComm(su, mConnection, urlPath1)) {					Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 1");					// todo: Alert, we don't support protocol 1 any more.				}*/			} else {				// if Gallery is embedded, only support protocol 2				return new GalleryComm2(g);			}		} catch (HTTPClient.ProtocolNotSuppException e) {			Log.logException(Log.LEVEL_ERROR, MODULE, e);		}		return null;	}