public static boolean checkHttpResponseOK (URLConnection connection) {
		if (connection instanceof HttpURLConnection)
			try {
				return ((HttpURLConnection)connection).getResponseCode() == HttpURLConnection.HTTP_OK;
			} catch (IOException e) {
				return false;
			}
		
		// exceptional treatment of local files, for testing convenience
		URL u = connection.getURL();
		if (u.getProtocol().equals("file"))
			try {
				return Files.isReadable(Paths.get(java.net.URLDecoder.decode(u.getFile().substring(1), "UTF-8")));
			} catch (UnsupportedEncodingException e) {
				return false;
			}
		return false; // unknown connection type
	}