SOLUTION!
InputStream in = new FileInputStream(file);
byte[] buf;
buf = new byte[in.available()];
while (in.read(buf) != -1) {
}
RequestBody requestBody = RequestBody
.create(MediaType.parse("application/octet-stream"), buf);
and send the created requestBody as the body of the POST. In my case, I am using RxJava, so the ApiService call looks like:
@POST(ApiUrls.Endpoint.UPLOAD_IMAGE_ATTACHMENT)
Observable<Void> uploadImageAttachment(
@Header(ApiUrls.Param.X_REQUEST_DIGEST) String digestValue,
@Path(ApiUrls.Param.RESULT_ID) int resultId,
@Path(ApiUrls.Param.FILE_NAME) String fileName,
@Body RequestBody photo);