@Override
    public InputStream download(String uri) {
        HttpURLConnection connection = null;
        String errorMsg;
        try {
            URL url = new URI(uri).toURL();
            connection = (HttpURLConnection) url.openConnection();
            connection.setDoOutput(false);

            // Check the HTTP response code
            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                LOGGER.debug(
                        "Download completed with HTTP response code: {}",
                        connection.getResponseCode());
                return org.apache.commons.io.IOUtils.toBufferedInputStream(
                        connection.getInputStream());
            }
            errorMsg = String.format("Unable to download. Response code: %d", responseCode);
            LOGGER.error(errorMsg);
            throw new ConductorClientException(errorMsg);
        } catch (URISyntaxException | MalformedURLException e) {
            errorMsg = String.format("Invalid uri specified: %s", uri);
            LOGGER.error(errorMsg, e);
            throw new ConductorClientException(errorMsg, e);
        } catch (IOException e) {
            errorMsg = String.format("Error downloading from uri: %s", uri);
            LOGGER.error(errorMsg, e);
            throw new ConductorClientException(errorMsg, e);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
Downloads the payload from the given uri.

@param uri the location from where the object is to be downloaded
@return an inputstream of the payload in the external storage
@throws ConductorClientException if the download fails due to an invalid path or an error
    from external storage
client/src/main/java/com/netflix/conductor/client/http/PayloadStorage.java