[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    [2/2] httpcomponents-client git commit: Corrected configuration of the 'expect-continue' handshake i
From:       olegk () apache ! org
Date:       2017-09-29 15:05:21
Message-ID: ecf6dc67c11d41f2835b53535e96c8f1 () git ! apache ! org
[Download RAW message or body]

Corrected configuration of the 'expect-continue' handshake in async
client authentication tests


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/5203c669
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/5203c669
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/5203c669

Branch: refs/heads/master
Commit: 5203c669289e15fa8dd6ce2e257e94c36423bd2d
Parents: 18e56cc
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Sep 28 15:39:43 2017 +0200
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Fri Sep 29 17:02:41 2017 +0200

----------------------------------------------------------------------
 .../testing/async/TestClientAuthentication.java | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/5203c669/httpclient5 \
-testing/src/test/java/org/apache/hc/client5/testing/async/TestClientAuthentication.java
                
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestClientAuthentication.java \
b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestClientAuthentication.java
 index fa54a35..afde7f2 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestClientAuthentication.java
                
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestClientAuthentication.java
 @@ -218,6 +218,34 @@ public class TestClientAuthentication extends \
IntegrationTestBase {  }
 
     @Test
+    public void testBasicAuthenticationWithEntitySuccess() throws Exception {
+        server.register("*", new Supplier<AsyncServerExchangeHandler>() {
+
+            @Override
+            public AsyncServerExchangeHandler get() {
+                return new AsyncEchoHandler();
+            }
+
+        });
+        final HttpHost target = start();
+
+        final TestCredentialsProvider credsProvider = new TestCredentialsProvider(
+                new UsernamePasswordCredentials("test", "test".toCharArray()));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCredentialsProvider(credsProvider);
+
+        final Future<SimpleHttpResponse> future = httpclient.execute(
+                SimpleHttpRequest.put(target, "/", "Some important stuff", \
ContentType.TEXT_PLAIN), context, null); +        final HttpResponse response = \
future.get(); +
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
+        final AuthScope authscope = credsProvider.getAuthScope();
+        Assert.assertNotNull(authscope);
+        Assert.assertEquals("test realm", authscope.getRealm());
+    }
+
+    @Test
     public void testBasicAuthenticationSuccessNonPersistentConnection() throws \
Exception {  server.register("*", new Supplier<AsyncServerExchangeHandler>() {
 
@@ -276,6 +304,7 @@ public class TestClientAuthentication extends IntegrationTestBase \
                {
                 new UsernamePasswordCredentials("test", "all-wrong".toCharArray()));
         final HttpClientContext context = HttpClientContext.create();
         context.setCredentialsProvider(credsProvider);
+        context.setRequestConfig(RequestConfig.custom().setExpectContinueEnabled(true).build());
  
         final Future<SimpleHttpResponse> future = httpclient.execute(
                 SimpleHttpRequest.put(target, "/", "Some important stuff", \
ContentType.TEXT_PLAIN), context, null); @@ -301,6 +330,7 @@ public class \
                TestClientAuthentication extends IntegrationTestBase {
                 new UsernamePasswordCredentials("test", "test".toCharArray()));
         final HttpClientContext context = HttpClientContext.create();
         context.setCredentialsProvider(credsProvider);
+        context.setRequestConfig(RequestConfig.custom().setExpectContinueEnabled(true).build());
  
         final Future<SimpleHttpResponse> future = httpclient.execute(
                 SimpleHttpRequest.put(target, "/", "Some important stuff", \
ContentType.TEXT_PLAIN), context, null);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic