hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1683474 - in /httpcomponents/httpcore/trunk/httpcore-nio/src: main/java/org/apache/http/nio/protocol/ test/java/org/apache/http/nio/integration/
Date Thu, 04 Jun 2015 07:31:25 GMT
Author: olegk
Date: Thu Jun  4 07:31:24 2015
New Revision: 1683474

URL: http://svn.apache.org/r1683474
Log:
HTTPCORE-403: fixed regression introduced by HTTPCORE-399

Added:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
  (contents, props changed)
      - copied, changed from r1683408, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java
Removed:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java?rev=1683474&r1=1683473&r2=1683474&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
Thu Jun  4 07:31:24 2015
@@ -165,11 +165,13 @@ public class HttpAsyncRequestExecutor im
                         state.getRequestState() == MessageState.COMPLETED,
                 "Unexpected request state %s", state.getRequestState());
 
-        if (state.getRequestState() != MessageState.READY) {
+        if (state.getRequestState() == MessageState.COMPLETED) {
+            conn.suspendOutput();
             return;
         }
         final HttpAsyncClientExchangeHandler handler = getHandler(conn);
         if (handler == null || handler.isDone()) {
+            conn.suspendOutput();
             return;
         }
         final boolean pipelined = handler.getClass().getAnnotation(Pipelined.class) != null;

Copied: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
(from r1683408, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java?p2=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java&p1=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java&r1=1683408&r2=1683474&rev=1683474&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
Thu Jun  4 07:31:24 2015
@@ -30,6 +30,8 @@ package org.apache.http.nio.integration;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -47,15 +49,26 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
-public class TestHttpsAsyncTimeout extends HttpCoreNIOTestBase {
+@RunWith(Parameterized.class)
+public class TestHttpAsyncTimeout extends HttpCoreNIOTestBase {
 
-    private ServerSocket serverSocket;
+    @Parameterized.Parameters(name = "{0}")
+    public static Collection<Object[]> protocols() {
+        return Arrays.asList(new Object[][]{
+                {ProtocolScheme.http},
+                {ProtocolScheme.https},
+        });
+    }
 
-    public TestHttpsAsyncTimeout() {
-        super(ProtocolScheme.https);
+    public TestHttpAsyncTimeout(final ProtocolScheme scheme) {
+        super(scheme);
     }
 
+    private ServerSocket serverSocket;
+
     @Before
     public void setUp() throws Exception {
         initClient();
@@ -82,7 +95,7 @@ public class TestHttpsAsyncTimeout exten
         // time out when SO_TIMEOUT has elapsed.
 
         final InetSocketAddress address = start();
-        final HttpHost target = new HttpHost("localhost", address.getPort(), "https");
+        final HttpHost target = new HttpHost("localhost", address.getPort(), getScheme().name());
 
         final CountDownLatch latch = new CountDownLatch(1);
 

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncTimeout.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message