Examples of preparePut()


Examples of org.asynchttpclient.AsyncHttpClient.preparePut()

    @Test(groups = { "standalone", "default_provider" })
    public void testPutEmptyBody() throws Exception {
        AsyncHttpClient ahc = getAsyncHttpClient(null);
        try {
            Response response = ahc.preparePut(getTargetUrl()).setBody("String").execute().get();

            assertNotNull(response);
            assertEquals(response.getStatusCode(), 204);
            assertEquals(response.getResponseBody(), "");
            assertTrue(response.getResponseBodyAsStream() instanceof InputStream);
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.preparePut()

                public void onThrowable(Throwable t) {
                    throwable.set(t);
                }
            });

            Response response = client.preparePut(getTargetUrl()).setBody(file).execute(tl).get();

            assertNotNull(response);
            assertEquals(response.getStatusCode(), 200);
            assertNotNull(hRead.get());
            assertNotNull(hSent.get());
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.preparePut()

                public void onThrowable(Throwable t) {
                    throwable.set(t);
                }
            });

            Response response = client.preparePut(getTargetUrl()).setBody(new FileBodyGenerator(file)).execute(tl).get();

            assertNotNull(response);
            assertEquals(response.getStatusCode(), 200);
            assertNotNull(hRead.get());
            assertNotNull(hSent.get());
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.preparePut()

        try {
            File largeFile = createTempFile(1024 * 100 * 10);
            final AtomicInteger byteReceived = new AtomicInteger();

            try {
                Response response = c.preparePut(getTargetUrl()).setBody(largeFile).execute(new AsyncCompletionHandlerAdapter() {
                    @Override
                    public STATE onBodyPartReceived(final HttpResponseBodyPart content) throws Exception {
                        byteReceived.addAndGet(content.getBodyByteBuffer().capacity());
                        return super.onBodyPartReceived(content);
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.