@Override
    public void upload(String uri, InputStream payload, long payloadSize) {
        HttpURLConnection connection = null;
        try {
            URL url = new URI(uri).toURL();

            connection = (HttpURLConnection) url.openConnection();
            connection.setDoOutput(true);
            connection.setRequestMethod("PUT");

            try (BufferedOutputStream bufferedOutputStream =
                    new BufferedOutputStream(connection.getOutputStream())) {
                long count = IOUtils.copy(payload, bufferedOutputStream);
                bufferedOutputStream.flush();
                // Check the HTTP response code
                int responseCode = connection.getResponseCode();
                if (Response.Status.fromStatusCode(responseCode).getFamily()
                        != Response.Status.Family.SUCCESSFUL) {
                    String errorMsg =
                            String.format("Unable to upload. Response code: %d", responseCode);
                    LOGGER.error(errorMsg);
                    throw new ConductorClientException(errorMsg);
                }
                LOGGER.debug(
                        "Uploaded {} bytes to uri: {}, with HTTP response code: {}",
                        count,
                        uri,
                        responseCode);
            }
        } catch (URISyntaxException | MalformedURLException e) {
            String errorMsg = String.format("Invalid path specified: %s", uri);
            LOGGER.error(errorMsg, e);
            throw new ConductorClientException(errorMsg, e);
        } catch (IOException e) {
            String errorMsg = String.format("Error uploading to path: %s", uri);
            LOGGER.error(errorMsg, e);
            throw new ConductorClientException(errorMsg, e);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
            try {
                if (payload != null) {
                    payload.close();
                }
            } catch (IOException e) {
                LOGGER.warn("Unable to close inputstream when uploading to uri: {}", uri);
            }
        }
    }
Uploads the payload to the uri specified.

@param uri the location to which the object is to be uploaded
@param payload an {@link InputStream} containing the json payload which is to be uploaded
@param payloadSize the size of the json payload in bytes
@throws ConductorClientException if the upload fails due to an invalid path or an error from
    external storage
client/src/main/java/com/netflix/conductor/client/http/PayloadStorage.java