aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-03-12 09:21:14 (EDT)
committerThomas Becker2013-03-12 09:21:29 (EDT)
commit8aeecf972bc8bfabfd2d6e723172e6456dfaae60 (patch)
tree0ec4993c3de8e2c17e4d27f71a8985c32ff6b8b2
parent6be028c040af360f796459e3e1070e0a5d1a37fe (diff)
downloadorg.eclipse.jetty.project-8aeecf972bc8bfabfd2d6e723172e6456dfaae60.zip
org.eclipse.jetty.project-8aeecf972bc8bfabfd2d6e723172e6456dfaae60.tar.gz
org.eclipse.jetty.project-8aeecf972bc8bfabfd2d6e723172e6456dfaae60.tar.bz2
SPDYToSPDYProxy add test where upstream server resets client stream
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
index 2739d1e..064f556 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
@@ -62,6 +62,9 @@ import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
@RunWith(value = Parameterized.class)
public class ProxySPDYToSPDYTest
{
@@ -186,6 +189,40 @@ public class ProxySPDYToSPDYTest
client.goAway(new GoAwayInfo(5, TimeUnit.SECONDS));
}
+@Test
+ public void testSYNThenRSTFromUpstreamServer() throws Exception
+ {
+ final String header = "foo";
+ InetSocketAddress proxyAddress = startProxy(startServer(new ServerSessionFrameListener.Adapter()
+ {
+ @Override
+ public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
+ {
+ Fields requestHeaders = synInfo.getHeaders();
+ Assert.assertNotNull(requestHeaders.get("via"));
+ Assert.assertNotNull(requestHeaders.get(header));
+ stream.getSession().rst(new RstInfo(stream.getId(), StreamStatus.REFUSED_STREAM), new Callback.Adapter());
+ return null;
+ }
+ }));
+ proxyConnector.addConnectionFactory(proxyConnector.getConnectionFactory("spdy/" + version));
+
+ final CountDownLatch resetLatch = new CountDownLatch(1);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, new SessionFrameListener.Adapter()
+ {
+ @Override
+ public void onRst(Session session, RstInfo rstInfo)
+ {
+ resetLatch.countDown();
+ }
+ }).get(5, TimeUnit.SECONDS);
+
+ Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
+ headers.put(header, "bar");
+ client.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter());
+
+ assertThat("reset is received by client", resetLatch.await(5, TimeUnit.SECONDS), is(true));
+ }
@Test
public void testSYNThenREPLYAndDATA() throws Exception