@Test public void testFileUploadInputStream() throws Exception { final File destination = getTempFile(); InputStream source = new ByteArrayInputStream(TEST_CONTENT.getBytes()); final AtomicReference<Map<String, String>> receivedParameters = new AtomicReference<Map<String, String>>(); final CountDownLatch latch = new CountDownLatch(1); webServer.setHttpFileUploadListener(new HttpFileUploadListener() { @Override public void handleHttpFileUpload(HttpFileUpload fileUpload) { fileUpload.moveTo(destination); receivedParameters.set(fileUpload.getParameters()); latch.countDown(); } }); String sourceParameterName = "myfile"; Map<String, String> expectedParameters = Maps.newHashMap(); expectedParameters.put("foo", "bar"); expectedParameters.put("bletch", "spam"); copier.copyTo(getUrlPrefix(), source, "foo.txt", sourceParameterName, expectedParameters); Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); Assert.assertEquals(TEST_CONTENT, FileSupportImpl.INSTANCE.readFile(destination).trim()); Assert.assertEquals(expectedParameters, receivedParameters.get()); }
@Override public void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params) { FileBody contentBody = new FileBody(source); doCopyTo(destinationUri, sourceParameterName, params, contentBody); }
HttpClientHttpContentCopier implements HttpContentCopier { @Override public void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params) { FileBody contentBody = new FileBody(source); doCopyTo(destinationUri, sourceParameterName, params, contentBody); } }
HttpClientHttpContentCopier implements HttpContentCopier { @Override public void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params) { FileBody contentBody = new FileBody(source); doCopyTo(destinationUri, sourceParameterName, params, contentBody); } HttpClientHttpContentCopier();  HttpClientHttpContentCopier(int totalConnectionsAllowed); }
HttpClientHttpContentCopier implements HttpContentCopier { @Override public void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params) { FileBody contentBody = new FileBody(source); doCopyTo(destinationUri, sourceParameterName, params, contentBody); } HttpClientHttpContentCopier();  HttpClientHttpContentCopier(int totalConnectionsAllowed); @Override void startup(); @Override void shutdown(); @Override String getContentAsString(String sourceUri); @Override String getContentAsString(String sourceUri, Charset charset); @Override void copy(String sourceUri, File destinationFile); @Override void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params); @Override void copyTo(String destinationUri, InputStream source, String sourceFileName, String sourceParameterName,
      Map<String, String> params); @Override int getTotalConnectionsAllowed(); }
HttpClientHttpContentCopier implements HttpContentCopier { @Override public void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params) { FileBody contentBody = new FileBody(source); doCopyTo(destinationUri, sourceParameterName, params, contentBody); } HttpClientHttpContentCopier();  HttpClientHttpContentCopier(int totalConnectionsAllowed); @Override void startup(); @Override void shutdown(); @Override String getContentAsString(String sourceUri); @Override String getContentAsString(String sourceUri, Charset charset); @Override void copy(String sourceUri, File destinationFile); @Override void copyTo(String destinationUri, File source, String sourceParameterName, Map<String, String> params); @Override void copyTo(String destinationUri, InputStream source, String sourceFileName, String sourceParameterName,
      Map<String, String> params); @Override int getTotalConnectionsAllowed(); static final int TOTAL_CONNECTIONS_ALLOWED_DEFAULT; }