private static EasyPostResponse makeURLConnectionRequest(EasyPostResource.RequestMethod method, String url, String query, String apiKey) throws EasyPostException {
		javax.net.ssl.HttpsURLConnection conn = null;
		try {
			switch (method) {
			case GET:
				conn = createGetConnection(url, query, apiKey);
				break;
			case POST:
				conn = createPostConnection(url, query, apiKey);
				break;
			case DELETE:
				conn = createDeleteConnection(url, query, apiKey);
				break;
			case PUT:
				conn = createPutConnection(url, query, apiKey);
				break;
			default:
				throw new EasyPostException(
					String.format("Unrecognized HTTP method %s. Please contact EasyPost at contact@easypost.com.", method));
			}
			int rCode = conn.getResponseCode(); // sends the request
			String rBody = null;
			if (rCode == 204) {
				rBody = "";
			} else if (rCode >= 200 && rCode < 300) {
				rBody = getResponseBody(conn.getInputStream());
			} else {
				rBody = getResponseBody(conn.getErrorStream());
			}
			return new EasyPostResponse(rCode, rBody);
		} catch (IOException e) {
			throw new EasyPostException(
				String.format(
					"Could not connect to EasyPost (%s). "
						+ "Please check your internet connection and try again. If this problem persists,"
						+ "please contact us at contact@easypost.com.", EasyPost.API_BASE), e);
		} finally {
			if (conn != null) {
				conn.disconnect();
			}
		}
	}