private String getAppInfoResponseStr() throws Exception { boolean hasGuiPlugin = Plugins.get(GUI_PLUGIN_ID) != null; String typeStr = determineType(hasGuiPlugin); String distStr = determineDist(hasGuiPlugin, typeStr); String snapshotsEnabled = (options.isSnapshots()) ? "true" : "false"; String osStr = EnvironmentUtil.getOperatingSystemDescription(); String archStr = EnvironmentUtil.getArchDescription(); String apiEndpointUrl = (options.getApiEndpoint() != null) ? options.getApiEndpoint() : API_DEFAULT_ENDPOINT_URL; URL appListUrl = new URL(String.format(API_APP_LIST_REQUEST_FORMAT, apiEndpointUrl, distStr, typeStr, snapshotsEnabled, osStr, archStr)); logger.log(Level.INFO, "Querying " + appListUrl + " ..."); eventBus.post(new ConnectToHostExternalEvent(appListUrl.getHost())); URLConnection urlConnection = appListUrl.openConnection(); urlConnection.setConnectTimeout(2000); urlConnection.setReadTimeout(2000); BufferedReader urlStreamReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); StringBuilder responseStringBuilder = new StringBuilder(); String line; while ((line = urlStreamReader.readLine()) != null) { responseStringBuilder.append(line); } String responseStr = responseStringBuilder.toString(); logger.log(Level.INFO, "Response from api.syncany.org: " + responseStr); return responseStr; }