code: private HttpPost setupRequest(ByteArrayOutputStream bos) {
      ContentBody cb = new ByteArrayBody(bos.toByteArray(), "image");
      HttpPost postRequest = new HttpPost(uri + "/uploadImage");
      MultipartEntity reqEntity = new MultipartEntity(
          HttpMultipartMode.BROWSER_COMPATIBLE);
  
      // add a single part to the request
      reqEntity.addPart("file", cb);
      postRequest.setEntity(reqEntity);
  
      return postRequest;
    }
docs: Create a post request encapsulating bytes from the given
  ByteArrayOutputStream.