411061 fix cookie handling in spdy. If two different HTTP headers with the same name are set, they should be translated to a single multiheader value according to: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.10-Name-Value-Header-Block. That applies for Set-Cookie headers for example. Before this changed duplicate header names have overwritten the previous one
This commit is contained in:
parent
43867ff075
commit
4085cfb602
|
@ -152,7 +152,7 @@ public class HttpTransportOverSPDY implements HttpTransport
|
||||||
HttpField field = fields.getField(i);
|
HttpField field = fields.getField(i);
|
||||||
String name = field.getName();
|
String name = field.getName();
|
||||||
String value = field.getValue();
|
String value = field.getValue();
|
||||||
headers.put(name, value);
|
headers.add(name, value);
|
||||||
LOG.debug("HTTP < {}: {}", name, value);
|
LOG.debug("HTTP < {}: {}", name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -56,7 +57,10 @@ import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
|
@ -77,9 +81,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("GET", httpRequest.getMethod());
|
assertEquals("GET", httpRequest.getMethod());
|
||||||
Assert.assertEquals(path, target);
|
assertEquals(path, target);
|
||||||
Assert.assertEquals(path, httpRequest.getRequestURI());
|
assertEquals(path, httpRequest.getRequestURI());
|
||||||
assertThat("accept-encoding is set to gzip, even if client didn't set it",
|
assertThat("accept-encoding is set to gzip, even if client didn't set it",
|
||||||
httpRequest.getHeader("accept-encoding"), containsString("gzip"));
|
httpRequest.getHeader("accept-encoding"), containsString("gzip"));
|
||||||
assertThat(httpRequest.getHeader("host"), is("localhost:" + connector.getLocalPort()));
|
assertThat(httpRequest.getHeader("host"), is("localhost:" + connector.getLocalPort()));
|
||||||
|
@ -94,14 +98,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -118,10 +122,10 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("GET", httpRequest.getMethod());
|
assertEquals("GET", httpRequest.getMethod());
|
||||||
Assert.assertEquals(path, target);
|
assertEquals(path, target);
|
||||||
Assert.assertEquals(path, httpRequest.getRequestURI());
|
assertEquals(path, httpRequest.getRequestURI());
|
||||||
Assert.assertEquals(query, httpRequest.getQueryString());
|
assertEquals(query, httpRequest.getQueryString());
|
||||||
handlerLatch.countDown();
|
handlerLatch.countDown();
|
||||||
}
|
}
|
||||||
}), null);
|
}), null);
|
||||||
|
@ -133,14 +137,62 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGETWithCookies() throws Exception
|
||||||
|
{
|
||||||
|
final String path = "/foo";
|
||||||
|
final String uri = path;
|
||||||
|
final String cookie1 = "cookie1";
|
||||||
|
final String cookie2 = "cookie2";
|
||||||
|
final String cookie1Value = "cookie 1 value";
|
||||||
|
final String cookie2Value = "cookie 2 value";
|
||||||
|
final CountDownLatch handlerLatch = new CountDownLatch(1);
|
||||||
|
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
|
||||||
|
throws IOException, ServletException
|
||||||
|
{
|
||||||
|
request.setHandled(true);
|
||||||
|
httpResponse.addCookie(new Cookie(cookie1, cookie1Value));
|
||||||
|
httpResponse.addCookie(new Cookie(cookie2, cookie2Value));
|
||||||
|
assertThat("method is GET", httpRequest.getMethod(), is("GET"));
|
||||||
|
assertThat("target is /foo", target, is(path));
|
||||||
|
assertThat("requestUri is /foo", httpRequest.getRequestURI(), is(path));
|
||||||
|
handlerLatch.countDown();
|
||||||
|
}
|
||||||
|
}), null);
|
||||||
|
|
||||||
|
Fields headers = SPDYTestUtils.createHeaders("localhost", connector.getPort(), version, "GET", uri);
|
||||||
|
final CountDownLatch replyLatch = new CountDownLatch(1);
|
||||||
|
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
|
{
|
||||||
|
assertThat("isClose is true", replyInfo.isClose(), is(true));
|
||||||
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
|
assertThat("response code is 200 OK", replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value()
|
||||||
|
.contains("200"), is(true));
|
||||||
|
assertThat(replyInfo.getHeaders().get("Set-Cookie").values()[0], is(cookie1 + "=\"" + cookie1Value +
|
||||||
|
"\""));
|
||||||
|
assertThat(replyInfo.getHeaders().get("Set-Cookie").values()[1], is(cookie2 + "=\"" + cookie2Value +
|
||||||
|
"\""));
|
||||||
|
replyLatch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -155,9 +207,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("HEAD", httpRequest.getMethod());
|
assertEquals("HEAD", httpRequest.getMethod());
|
||||||
Assert.assertEquals(path, target);
|
assertEquals(path, target);
|
||||||
Assert.assertEquals(path, httpRequest.getRequestURI());
|
assertEquals(path, httpRequest.getRequestURI());
|
||||||
handlerLatch.countDown();
|
handlerLatch.countDown();
|
||||||
}
|
}
|
||||||
}), null);
|
}), null);
|
||||||
|
@ -169,14 +221,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -192,17 +244,17 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("POST", httpRequest.getMethod());
|
assertEquals("POST", httpRequest.getMethod());
|
||||||
Assert.assertEquals("1", httpRequest.getParameter("a"));
|
assertEquals("1", httpRequest.getParameter("a"));
|
||||||
Assert.assertEquals("2", httpRequest.getParameter("b"));
|
assertEquals("2", httpRequest.getParameter("b"));
|
||||||
Assert.assertNotNull(httpRequest.getRemoteHost());
|
assertNotNull(httpRequest.getRemoteHost());
|
||||||
Assert.assertNotNull(httpRequest.getRemotePort());
|
assertNotNull(httpRequest.getRemotePort());
|
||||||
Assert.assertNotNull(httpRequest.getRemoteAddr());
|
assertNotNull(httpRequest.getRemoteAddr());
|
||||||
Assert.assertNotNull(httpRequest.getLocalPort());
|
assertNotNull(httpRequest.getLocalPort());
|
||||||
Assert.assertNotNull(httpRequest.getLocalName());
|
assertNotNull(httpRequest.getLocalName());
|
||||||
Assert.assertNotNull(httpRequest.getLocalAddr());
|
assertNotNull(httpRequest.getLocalAddr());
|
||||||
Assert.assertNotNull(httpRequest.getServerPort());
|
assertNotNull(httpRequest.getServerPort());
|
||||||
Assert.assertNotNull(httpRequest.getServerName());
|
assertNotNull(httpRequest.getServerName());
|
||||||
handlerLatch.countDown();
|
handlerLatch.countDown();
|
||||||
}
|
}
|
||||||
}), null);
|
}), null);
|
||||||
|
@ -216,16 +268,16 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.data(new StringDataInfo(data, true));
|
stream.data(new StringDataInfo(data, true));
|
||||||
|
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -242,9 +294,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("POST", httpRequest.getMethod());
|
assertEquals("POST", httpRequest.getMethod());
|
||||||
Assert.assertEquals("1", httpRequest.getParameter("a"));
|
assertEquals("1", httpRequest.getParameter("a"));
|
||||||
Assert.assertEquals("2", httpRequest.getParameter("b"));
|
assertEquals("2", httpRequest.getParameter("b"));
|
||||||
handlerLatch.countDown();
|
handlerLatch.countDown();
|
||||||
}
|
}
|
||||||
}), null);
|
}), null);
|
||||||
|
@ -258,9 +310,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -269,8 +321,8 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
stream.data(new StringDataInfo(data2, true));
|
stream.data(new StringDataInfo(data2, true));
|
||||||
|
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -287,9 +339,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
Assert.assertEquals("POST", httpRequest.getMethod());
|
assertEquals("POST", httpRequest.getMethod());
|
||||||
Assert.assertEquals("1", httpRequest.getParameter("a"));
|
assertEquals("1", httpRequest.getParameter("a"));
|
||||||
Assert.assertEquals("2", httpRequest.getParameter("b"));
|
assertEquals("2", httpRequest.getParameter("b"));
|
||||||
handlerLatch.countDown();
|
handlerLatch.countDown();
|
||||||
}
|
}
|
||||||
}), null);
|
}), null);
|
||||||
|
@ -302,9 +354,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.toString(), replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.toString(), replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -313,8 +365,8 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
stream.data(new StringDataInfo(data1, false));
|
stream.data(new StringDataInfo(data1, false));
|
||||||
stream.data(new StringDataInfo(data2, true));
|
stream.data(new StringDataInfo(data2, true));
|
||||||
|
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -346,21 +398,21 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onData(Stream stream, DataInfo dataInfo)
|
public void onData(Stream stream, DataInfo dataInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(dataInfo.isClose());
|
assertTrue(dataInfo.isClose());
|
||||||
Assert.assertEquals(data, dataInfo.asString("UTF-8", true));
|
assertEquals(data, dataInfo.asString("UTF-8", true));
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -392,23 +444,23 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onData(Stream stream, DataInfo dataInfo)
|
public void onData(Stream stream, DataInfo dataInfo)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(dataInfo.isClose());
|
assertTrue(dataInfo.isClose());
|
||||||
byte[] bytes = dataInfo.asBytes(true);
|
byte[] bytes = dataInfo.asBytes(true);
|
||||||
Assert.assertEquals(1, bytes.length);
|
assertEquals(1, bytes.length);
|
||||||
Assert.assertEquals(data, bytes[0]);
|
assertEquals(data, bytes[0]);
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -444,10 +496,10 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replyFrames.incrementAndGet());
|
assertEquals(1, replyFrames.incrementAndGet());
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,17 +507,17 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onData(Stream stream, DataInfo dataInfo)
|
public void onData(Stream stream, DataInfo dataInfo)
|
||||||
{
|
{
|
||||||
int data = dataFrames.incrementAndGet();
|
int data = dataFrames.incrementAndGet();
|
||||||
Assert.assertTrue(data >= 1 && data <= 2);
|
assertTrue(data >= 1 && data <= 2);
|
||||||
if (data == 1)
|
if (data == 1)
|
||||||
Assert.assertEquals(data1, dataInfo.asString("UTF8", true));
|
assertEquals(data1, dataInfo.asString("UTF8", true));
|
||||||
else
|
else
|
||||||
Assert.assertEquals(data2, dataInfo.asString("UTF8", true));
|
assertEquals(data2, dataInfo.asString("UTF8", true));
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -500,7 +552,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,14 +562,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(data.length, contentBytes.get());
|
assertEquals(data.length, contentBytes.get());
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -536,7 +588,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
request.setHandled(true);
|
request.setHandled(true);
|
||||||
httpResponse.setStatus(HttpServletResponse.SC_OK);
|
httpResponse.setStatus(HttpServletResponse.SC_OK);
|
||||||
ServletOutputStream output = httpResponse.getOutputStream();
|
ServletOutputStream output = httpResponse.getOutputStream();
|
||||||
for(int i = 0 ; i< writeTimes ; i++)
|
for (int i = 0; i < writeTimes; i++)
|
||||||
{
|
{
|
||||||
output.write(data);
|
output.write(data);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +608,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,14 +618,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(data.length * writeTimes, contentBytes.get());
|
assertEquals(data.length * writeTimes, contentBytes.get());
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -609,7 +661,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,14 +671,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
contentBytes.addAndGet(dataInfo.asByteBuffer(true).remaining());
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(2 * data.length, contentBytes.get());
|
assertEquals(2 * data.length, contentBytes.get());
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -662,7 +714,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,14 +726,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
buffer.write(byteBuffer.get());
|
buffer.write(byteBuffer.get());
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(data, new String(buffer.toByteArray(), Charset.forName("UTF-8")));
|
assertEquals(data, new String(buffer.toByteArray(), Charset.forName("UTF-8")));
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -720,7 +772,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,14 +784,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
buffer.write(byteBuffer.get());
|
buffer.write(byteBuffer.get());
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(data2, new String(buffer.toByteArray(), Charset.forName("UTF-8")));
|
assertEquals(data2, new String(buffer.toByteArray(), Charset.forName("UTF-8")));
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -770,16 +822,16 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replies.incrementAndGet());
|
assertEquals(1, replies.incrementAndGet());
|
||||||
Assert.assertTrue(replyInfo.isClose());
|
assertTrue(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("302"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("302"));
|
||||||
Assert.assertTrue(replyHeaders.get("location").value().endsWith(suffix));
|
assertTrue(replyHeaders.get("location").value().endsWith(suffix));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -808,10 +860,10 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replies.incrementAndGet());
|
assertEquals(1, replies.incrementAndGet());
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("404"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("404"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,9 +874,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -853,9 +905,9 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replies.incrementAndGet());
|
assertEquals(1, replies.incrementAndGet());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("500"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("500"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
if (replyInfo.isClose())
|
if (replyInfo.isClose())
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
|
@ -868,8 +920,8 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
|
|
||||||
log.setHideStacks(false);
|
log.setHideStacks(false);
|
||||||
}
|
}
|
||||||
|
@ -908,11 +960,11 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replyFrames.incrementAndGet());
|
assertEquals(1, replyFrames.incrementAndGet());
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
Assert.assertTrue(replyHeaders.get("extra").value().contains("X"));
|
assertTrue(replyHeaders.get("extra").value().contains("X"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,19 +975,19 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
Assert.assertFalse(dataInfo.isClose());
|
Assert.assertFalse(dataInfo.isClose());
|
||||||
Assert.assertEquals(pangram1, dataInfo.asString("UTF-8", true));
|
assertEquals(pangram1, dataInfo.asString("UTF-8", true));
|
||||||
}
|
}
|
||||||
else if (count == 2)
|
else if (count == 2)
|
||||||
{
|
{
|
||||||
Assert.assertTrue(dataInfo.isClose());
|
assertTrue(dataInfo.isClose());
|
||||||
Assert.assertEquals(pangram2, dataInfo.asString("UTF-8", true));
|
assertEquals(pangram2, dataInfo.asString("UTF-8", true));
|
||||||
}
|
}
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("The correspondent functionality in HttpOutput is not yet implemented")
|
@Ignore("The correspondent functionality in HttpOutput is not yet implemented")
|
||||||
|
@ -990,10 +1042,10 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
@Override
|
@Override
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(1, replyFrames.incrementAndGet());
|
assertEquals(1, replyFrames.incrementAndGet());
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,14 +1055,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
contentLength.addAndGet(dataInfo.asBytes(true).length);
|
contentLength.addAndGet(dataInfo.asBytes(true).length);
|
||||||
if (dataInfo.isClose())
|
if (dataInfo.isClose())
|
||||||
{
|
{
|
||||||
Assert.assertEquals(length, contentLength.get());
|
assertEquals(length, contentLength.get());
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1046,7 +1098,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
{
|
{
|
||||||
Assert.assertFalse(replyInfo.isClose());
|
Assert.assertFalse(replyInfo.isClose());
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,8 +1111,8 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
dataLatch.countDown();
|
dataLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Assert.assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(dataLatch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertEquals(3 * data.length, contentLength.get());
|
assertEquals(3 * data.length, contentLength.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1107,14 +1159,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.data(new BytesDataInfo(data, true));
|
stream.data(new BytesDataInfo(data, true));
|
||||||
|
|
||||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1150,14 +1202,14 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.assertTrue("Not dispatched again after expire", dispatchedAgainAfterExpire.await(5,
|
assertTrue("Not dispatched again after expire", dispatchedAgainAfterExpire.await(5,
|
||||||
TimeUnit.SECONDS));
|
TimeUnit.SECONDS));
|
||||||
Assert.assertTrue("Reply not sent", replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue("Reply not sent", replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1195,15 +1247,15 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.data(new BytesDataInfo(data, true));
|
stream.data(new BytesDataInfo(data, true));
|
||||||
|
|
||||||
Assert.assertTrue("Not dispatched again after expire", dispatchedAgainAfterExpire.await(5,
|
assertTrue("Not dispatched again after expire", dispatchedAgainAfterExpire.await(5,
|
||||||
TimeUnit.SECONDS));
|
TimeUnit.SECONDS));
|
||||||
Assert.assertTrue("Reply not sent", replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue("Reply not sent", replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readRequestData(Request request, int expectedDataLength) throws IOException
|
private void readRequestData(Request request, int expectedDataLength) throws IOException
|
||||||
|
@ -1263,15 +1315,15 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
replyLatch.countDown();
|
replyLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.data(new BytesDataInfo(data, false));
|
stream.data(new BytesDataInfo(data, false));
|
||||||
stream.data(new BytesDataInfo(data, true));
|
stream.data(new BytesDataInfo(data, true));
|
||||||
|
|
||||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1331,7 +1383,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
responseLatch.countDown();
|
responseLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,8 +1396,8 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
});
|
});
|
||||||
stream.data(new BytesDataInfo(data, true));
|
stream.data(new BytesDataInfo(data, true));
|
||||||
|
|
||||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(responseLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(responseLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1372,15 +1424,15 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||||
public void onReply(Stream stream, ReplyInfo replyInfo)
|
public void onReply(Stream stream, ReplyInfo replyInfo)
|
||||||
{
|
{
|
||||||
Fields replyHeaders = replyInfo.getHeaders();
|
Fields replyHeaders = replyInfo.getHeaders();
|
||||||
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||||
responseLatch.countDown();
|
responseLatch.countDown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.data(new BytesDataInfo(data, false));
|
stream.data(new BytesDataInfo(data, false));
|
||||||
stream.data(new BytesDataInfo(5, TimeUnit.SECONDS, data, true));
|
stream.data(new BytesDataInfo(5, TimeUnit.SECONDS, data, true));
|
||||||
|
|
||||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
Assert.assertTrue(responseLatch.await(5, TimeUnit.SECONDS));
|
assertTrue(responseLatch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue