}
}
@Test(groups = { "standalone", "default_provider" })
public void testMultiPartPost() throws Exception {
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setProviderClass(getProviderClass()).setUrl(getTargetUrl() + "/multipart").build();
try {
Response response = client.post(new ByteArrayPart("baPart", "testMultiPart".getBytes(UTF_8), "application/test", UTF_8, "fileName")).get();
String body = response.getResponseBody();
String contentType = response.getHeader("X-Content-Type");
assertTrue(contentType.contains("multipart/form-data"));
String boundary = contentType.substring(contentType.lastIndexOf("=") + 1);
assertTrue(body.startsWith("--" + boundary));
assertTrue(body.trim().endsWith("--" + boundary + "--"));
assertTrue(body.contains("Content-Disposition:"));
assertTrue(body.contains("Content-Type: application/test"));
assertTrue(body.contains("name=\"baPart"));
assertTrue(body.contains("filename=\"fileName"));
} finally {
client.close();
}
}