class UrlHelper {

    public JSONObject parseJsonObjectFromUrl(String url)
    {
        try
        {
            // Get proxy information.
            Proxy proxy;
            String httpProxyHost = configurationHelper.getProperty(ConfigurationValue.HTTP_PROXY_HOST);
            Integer httpProxyPort = configurationHelper.getProperty(ConfigurationValue.HTTP_PROXY_PORT, Integer.class);
            if (StringUtils.isNotBlank(httpProxyHost) && httpProxyPort != null)
            {
                proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(httpProxyHost, httpProxyPort));
            }
            else
            {
                proxy = Proxy.NO_PROXY;
            }

            // Open an input stream as per specified URL.
            InputStream inputStream = urlOperations.openStream(new URL(url), proxy);

            try
            {
                // Parse the JSON object from the input stream.
                JSONParser jsonParser = new JSONParser();
                return (JSONObject) jsonParser.parse(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
            }
            catch (ParseException e)
            {
                throw new IllegalArgumentException(String.format("Failed to parse JSON object from the URL: url=\"%s\"", url), e);
            }
            finally
            {
                inputStream.close();
            }
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException(String.format("Failed to read JSON from the URL: url=\"%s\"", url), e);
        }
    }

}