RestHttpHelper { public HttpResponse multipartFileStreamPost(String url, String fileName, InputStream stream) throws Exception { ContentType contentType = ContentType.MULTIPART_FORM_DATA; HttpEntity reqEntity = MultipartEntityBuilder.create() .addBinaryBody(fileName, stream, contentType, fileName).build(); return multipartPost(url, reqEntity); } RestHttpHelper();  RestHttpHelper(int socketTimeoutMs);  RestHttpHelper(Credential credential);  RestHttpHelper(Credential credential, int socketTimeoutMs); HttpResponse get(String url); HttpResponse get(String url,
                            Map<String, String> headers); HttpResponse head(String url); HttpResponse delete(String url); HttpResponse post(String url,
                             String requestContent,
                             Map<String, String> headers); HttpResponse post(String url,
                             String requestContent,
                             String mimeType,
                             Map<String, String> headers); HttpResponse post(String url,
                             InputStream requestContent,
                             String mimeType,
                             long contentLength,
                             Map<String, String> headers); HttpResponse put(String url,
                            String requestContent,
                            Map<String, String> headers); HttpResponse put(String url,
                            String requestContent,
                            String mimeType,
                            Map<String, String> headers); HttpResponse put(String url,
                            InputStream requestContent,
                            String mimeType,
                            long contentLength,
                            Map<String, String> headers); HttpResponse multipartFilePost(String url, File file); HttpResponse multipartFileStreamPost(String url,
                                                String fileName,
                                                InputStream stream); HttpResponse multipartPost(String url, HttpEntity reqEntity);  }
@Test public void testMultipartFileStreamPost() throws Exception { File file = createTmpFile(); FileInputStream fileStream = new FileInputStream(file); HttpResponse response = helper.multipartFileStreamPost(getUrl(), file.getName(), fileStream); verifyResponse(response); file.delete(); }