Jetty9 - Parametrized tests on the SPDY version.

This commit is contained in:
Simone Bordet 2012-08-29 21:03:34 +02:00
parent bf30ec24a5
commit 2d7a80c44b
8 changed files with 263 additions and 293 deletions

View File

@ -16,10 +16,11 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
@ -35,10 +36,19 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.After;
import org.junit.Rule;
import org.junit.rules.TestWatchman;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.model.FrameworkMethod;
@RunWith(Parameterized.class)
public abstract class AbstractHTTPSPDYTest
{
@Parameterized.Parameters
public static Collection<Short[]> parameters()
{
return Arrays.asList(new Short[]{SPDY.V2}, new Short[]{SPDY.V3});
}
@Rule
public final TestWatchman testName = new TestWatchman()
{
@ -52,10 +62,16 @@ public abstract class AbstractHTTPSPDYTest
}
};
protected final short version;
protected Server server;
protected SPDYClient.Factory clientFactory;
protected SPDYServerConnector connector;
protected AbstractHTTPSPDYTest(short version)
{
this.version = version;
}
protected InetSocketAddress startHTTPServer(Handler handler) throws Exception
{
return startHTTPServer(SPDY.V2, handler);
@ -117,9 +133,4 @@ public abstract class AbstractHTTPSPDYTest
server.join();
}
}
protected short version()
{
return SPDY.V2;
}
}

View File

@ -16,7 +16,6 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import java.io.IOException;
@ -39,12 +38,17 @@ import org.junit.Test;
public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
{
public ConcurrentStreamsTest(short version)
{
super(version);
}
@Test
public void testSlowStreamDoesNotBlockOtherStreams() throws Exception
{
final CountDownLatch slowServerLatch = new CountDownLatch(1);
final CountDownLatch fastServerLatch = new CountDownLatch(1);
Session session = startClient(startHTTPServer(new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -76,10 +80,10 @@ public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
// Perform slow request. This will wait on server side until the fast request wakes it up
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/slow");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/slow");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch slowClientLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -87,17 +91,17 @@ public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get("status").value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
slowClientLatch.countDown();
}
});
// Perform the fast request. This will wake up the slow request
headers.clear();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/fast");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/fast");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch fastClientLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -105,7 +109,7 @@ public class ConcurrentStreamsTest extends AbstractHTTPSPDYTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get("status").value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
fastClientLatch.countDown();
}
});

View File

@ -43,7 +43,9 @@ import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.junit.Ignore;
@Ignore // TODO: update when jetty client is available
public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
{
// Sample resources size from webtide.com home page
@ -60,12 +62,17 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
private final long roundtrip = 100;
private final int runs = 10;
public PushStrategyBenchmarkTest(short version)
{
super(version);
}
//TODO:
// @Test
// public void benchmarkPushStrategy() throws Exception
// {
// InetSocketAddress address = startHTTPServer(version(), new PushStrategyBenchmarkHandler());
// InetSocketAddress address = startHTTPServer(version, new PushStrategyBenchmarkHandler());
//
// // Plain HTTP
// ConnectionFactory dacf = new ServerHTTPAsyncConnectionFactory(connector);
@ -79,17 +86,17 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
//
// // First push strategy
// PushStrategy pushStrategy = new PushStrategy.None();
// dacf = new ServerHTTPSPDYAsyncConnectionFactory(version(), connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
// dacf = new ServerHTTPSPDYAsyncConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
// connector.setDefaultAsyncConnectionFactory(dacf);
// Session session = startClient(version(), address, new ClientSessionFrameListener());
// Session session = startClient(version, address, new ClientSessionFrameListener());
// benchmarkSPDY(pushStrategy, session);
// session.goAway().get(5, TimeUnit.SECONDS);
//
// // Second push strategy
// pushStrategy = new ReferrerPushStrategy();
// dacf = new ServerHTTPSPDYAsyncConnectionFactory(version(), connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
// dacf = new ServerHTTPSPDYAsyncConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
// connector.setDefaultAsyncConnectionFactory(dacf);
// session = startClient(version(), address, new ClientSessionFrameListener());
// session = startClient(version, address, new ClientSessionFrameListener());
// benchmarkSPDY(pushStrategy, session);
// session.goAway().get(5, TimeUnit.SECONDS);
// }
@ -209,11 +216,11 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
String primaryPath = "/" + j + ".html";
String referrer = new StringBuilder("http://localhost:").append(connector.getLocalPort()).append(primaryPath).toString();
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), primaryPath);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), primaryPath);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
// Wait for the HTML to simulate browser's behavior
++result;
final CountDownLatch htmlLatch = new CountDownLatch(1);
@ -267,11 +274,11 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
{
Headers headers;
headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
headers.put("referer", referrer);
return headers;
}
@ -336,7 +343,7 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
private void addPushedResource(String pushedURI)
{
switch (version())
switch (version)
{
case SPDY.V2:
{
@ -362,7 +369,7 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
{
String path = synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version())).value();
String path = synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version)).value();
addPushedResource(path);
return new DataListener();
}

View File

@ -16,7 +16,6 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import java.io.IOException;
@ -44,12 +43,16 @@ import org.eclipse.jetty.spdy.api.SynInfo;
import org.junit.Assert;
import org.junit.Test;
public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
{
private final String mainResource = "/index.html";
private final String cssResource = "/style.css";
public ReferrerPushStrategyTest(short version)
{
super(version);
}
@Override
protected SPDYServerConnector newHTTPSPDYServerConnector(short version)
{
@ -67,7 +70,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
ReferrerPushStrategy pushStrategy = new ReferrerPushStrategy();
int referrerPushPeriod = 1000;
pushStrategy.setReferrerPushPeriod(referrerPushPeriod);
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version(), connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
connector.setDefaultConnectionFactory(defaultFactory);
Headers mainRequestHeaders = createHeadersWithoutReferrer(mainResource);
@ -89,7 +92,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
ReferrerPushStrategy pushStrategy = new ReferrerPushStrategy();
int referrerPushPeriod = 1000;
pushStrategy.setReferrerPushPeriod(referrerPushPeriod);
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version(),
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version,
connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
connector.setDefaultConnectionFactory(defaultFactory);
@ -111,7 +114,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
ReferrerPushStrategy pushStrategy = new ReferrerPushStrategy();
pushStrategy.setMaxAssociatedResources(1);
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version(),
ConnectionFactory defaultFactory = new ServerHTTPSPDYAsyncConnectionFactory(version,
connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), connector, pushStrategy);
connector.setDefaultConnectionFactory(defaultFactory);
@ -125,7 +128,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
private InetSocketAddress createServer() throws Exception
{
return startHTTPServer(version(), new AbstractHandler()
return startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -145,7 +148,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
private Session sendMainRequestAndCSSRequest(InetSocketAddress address, Headers mainRequestHeaders) throws Exception
{
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
session1.syn(new SynInfo(mainRequestHeaders, true), new StreamFrameListener.Adapter()
@ -203,7 +206,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushDataLatch = new CountDownLatch(1);
final CountDownLatch pushSynHeadersValid = new CountDownLatch(1);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
@ -212,7 +215,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
validateHeaders(synInfo.getHeaders(), pushSynHeadersValid);
Assert.assertTrue(stream.isUnidirectional());
Assert.assertTrue(synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version())).value().endsWith(".css"));
Assert.assertTrue(synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version)).value().endsWith(".css"));
return new StreamFrameListener.Adapter()
{
@Override
@ -253,7 +256,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
@Test
public void testAssociatedResourceIsPushed() throws Exception
{
InetSocketAddress address = startHTTPServer(version(), new AbstractHandler()
InetSocketAddress address = startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -267,7 +270,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
baseRequest.setHandled(true);
}
});
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
Headers mainRequestHeaders = createHeadersWithoutReferrer(mainResource);
@ -302,7 +305,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushDataLatch = new CountDownLatch(1);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
@ -346,7 +349,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
public void testAssociatedResourceWithWrongContentTypeIsNotPushed() throws Exception
{
final String fakeResource = "/fake.png";
InetSocketAddress address = startHTTPServer(version(), new AbstractHandler()
InetSocketAddress address = startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -371,7 +374,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
baseRequest.setHandled(true);
}
});
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
Headers mainRequestHeaders = createHeadersWithoutReferrer(mainResource);
@ -422,13 +425,13 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushDataLatch = new CountDownLatch(1);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
{
Assert.assertTrue(stream.isUnidirectional());
Assert.assertTrue(synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version())).value().endsWith(".css"));
Assert.assertTrue(synInfo.getHeaders().get(HTTPSPDYHeader.URI.name(version)).value().endsWith(".css"));
return new StreamFrameListener.Adapter()
{
@Override
@ -466,7 +469,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
@Test
public void testNestedAssociatedResourceIsPushed() throws Exception
{
InetSocketAddress address = startHTTPServer(version(), new AbstractHandler()
InetSocketAddress address = startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -482,7 +485,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
baseRequest.setHandled(true);
}
});
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
Headers mainRequestHeaders = createHeadersWithoutReferrer(mainResource);
@ -533,7 +536,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushDataLatch = new CountDownLatch(2);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
@ -576,7 +579,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
@Test
public void testMainResourceWithReferrerIsNotPushed() throws Exception
{
InetSocketAddress address = startHTTPServer(version(), new AbstractHandler()
InetSocketAddress address = startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -588,7 +591,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
baseRequest.setHandled(true);
}
});
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
Headers mainRequestHeaders = createHeadersWithoutReferrer(mainResource);
@ -625,7 +628,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushLatch = new CountDownLatch(1);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
@ -659,7 +662,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
@Test
public void testRequestWithIfModifiedSinceHeaderPreventsPush() throws Exception
{
InetSocketAddress address = startHTTPServer(version(), new AbstractHandler()
InetSocketAddress address = startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
@ -673,7 +676,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
baseRequest.setHandled(true);
}
});
Session session1 = startClient(version(), address, null);
Session session1 = startClient(version, address, null);
final CountDownLatch mainResourceLatch = new CountDownLatch(1);
Headers mainRequestHeaders = createHeaders(mainResource);
@ -709,7 +712,7 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
final CountDownLatch mainStreamLatch = new CountDownLatch(2);
final CountDownLatch pushDataLatch = new CountDownLatch(1);
Session session2 = startClient(version(), address, new SessionFrameListener.Adapter()
Session session2 = startClient(version, address, new SessionFrameListener.Adapter()
{
@Override
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
@ -751,8 +754,8 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
private void validateHeaders(Headers headers, CountDownLatch pushSynHeadersValid)
{
if (validateHeader(headers, HTTPSPDYHeader.STATUS.name(version()), "200")
&& validateHeader(headers, HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1")
if (validateHeader(headers, HTTPSPDYHeader.STATUS.name(version), "200")
&& validateHeader(headers, HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1")
&& validateUriHeader(headers))
pushSynHeadersValid.countDown();
}
@ -768,14 +771,14 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
private boolean validateUriHeader(Headers headers)
{
Headers.Header uriHeader = headers.get(HTTPSPDYHeader.URI.name(version()));
Headers.Header uriHeader = headers.get(HTTPSPDYHeader.URI.name(version));
if (uriHeader != null)
if (version() == SPDY.V2 && uriHeader.value().startsWith("http://"))
if (version == SPDY.V2 && uriHeader.value().startsWith("http://"))
return true;
else if (version() == SPDY.V3 && uriHeader.value().startsWith("/")
&& headers.get(HTTPSPDYHeader.HOST.name(version())) != null && headers.get(HTTPSPDYHeader.SCHEME.name(version())) != null)
else if (version == SPDY.V3 && uriHeader.value().startsWith("/")
&& headers.get(HTTPSPDYHeader.HOST.name(version)) != null && headers.get(HTTPSPDYHeader.SCHEME.name(version)) != null)
return true;
System.out.println(HTTPSPDYHeader.URI.name(version()) + " not valid!");
System.out.println(HTTPSPDYHeader.URI.name(version) + " not valid!");
return false;
}
@ -794,11 +797,11 @@ public class ReferrerPushStrategyV2Test extends AbstractHTTPSPDYTest
private Headers createHeadersWithoutReferrer(String resource)
{
Headers associatedRequestHeaders = new Headers();
associatedRequestHeaders.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
associatedRequestHeaders.put(HTTPSPDYHeader.URI.name(version()), resource);
associatedRequestHeaders.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
associatedRequestHeaders.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
associatedRequestHeaders.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
associatedRequestHeaders.put(HTTPSPDYHeader.METHOD.name(version), "GET");
associatedRequestHeaders.put(HTTPSPDYHeader.URI.name(version), resource);
associatedRequestHeaders.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
associatedRequestHeaders.put(HTTPSPDYHeader.SCHEME.name(version), "http");
associatedRequestHeaders.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
return associatedRequestHeaders;
}
}

View File

@ -1,31 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import org.eclipse.jetty.spdy.api.SPDY;
public class ReferrerPushStrategyV3Test extends ReferrerPushStrategyV2Test
{
@Override
protected short version()
{
return SPDY.V3;
}
}

View File

@ -30,7 +30,6 @@ import java.util.regex.Pattern;
import org.eclipse.jetty.spdy.SPDYClient;
import org.eclipse.jetty.spdy.api.Headers;
import org.eclipse.jetty.spdy.api.ReplyInfo;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
@ -42,6 +41,11 @@ import org.junit.Test;
public class SSLExternalServerTest extends AbstractHTTPSPDYTest
{
public SSLExternalServerTest(short version)
{
super(version);
}
@Override
protected SPDYClient.Factory newSPDYClientFactory(Executor threadPool)
{
@ -70,7 +74,6 @@ public class SSLExternalServerTest extends AbstractHTTPSPDYTest
Assume.assumeNoException(x);
}
final short version = SPDY.V2;
Session session = startClient(version, address, null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.SCHEME.name(version), "https");

View File

@ -16,7 +16,6 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import java.io.ByteArrayInputStream;
@ -52,14 +51,19 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
{
public ServerHTTPSPDYTest(short version)
{
super(version);
}
@Test
public void testSimpleGET() throws Exception
{
final String path = "/foo";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -75,11 +79,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -88,7 +92,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
});
@ -103,7 +107,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String query = "p=1";
final String uri = path + "?" + query;
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -119,11 +123,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), uri);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), uri);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -132,7 +136,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
});
@ -145,7 +149,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final String path = "/foo";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -160,11 +164,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "HEAD");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "HEAD");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -173,7 +177,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
});
@ -187,7 +191,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String path = "/foo";
final String data = "a=1&b=2";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -210,11 +214,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
headers.put("content-type", "application/x-www-form-urlencoded");
final CountDownLatch replyLatch = new CountDownLatch(1);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
@ -224,7 +228,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
}).get(5, TimeUnit.SECONDS);
@ -241,7 +245,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String data1 = "a=1&";
final String data2 = "b=2";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -256,11 +260,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
headers.put("content-type", "application/x-www-form-urlencoded");
final CountDownLatch replyLatch = new CountDownLatch(1);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
@ -270,7 +274,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
}).get(5, TimeUnit.SECONDS);
@ -290,7 +294,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String data1 = "a=1&";
final String data2 = "b=2";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -305,11 +309,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), path);
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), path);
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
headers.put("content-type", "application/x-www-form-urlencoded");
final CountDownLatch replyLatch = new CountDownLatch(1);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
@ -319,7 +323,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.toString(), replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.toString(), replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
}).get(5, TimeUnit.SECONDS);
@ -336,7 +340,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final String data = "0123456789ABCDEF";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -351,11 +355,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -365,7 +369,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -387,7 +391,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final char data = 'x';
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -402,11 +406,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -416,7 +420,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -441,7 +445,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String data1 = "0123456789ABCDEF";
final String data2 = "FEDCBA9876543210";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -458,11 +462,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(2);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -476,7 +480,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
Assert.assertEquals(1, replyFrames.incrementAndGet());
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -503,7 +507,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final byte[] data = new byte[128 * 1024];
Arrays.fill(data, (byte)'x');
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -518,11 +522,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -534,7 +538,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -560,7 +564,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final byte[] data = new byte[128 * 1024];
Arrays.fill(data, (byte)'y');
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -576,11 +580,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -592,7 +596,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -617,7 +621,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final String data = "0123456789ABCDEF";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -634,11 +638,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -650,7 +654,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -678,7 +682,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String data1 = "0123456789ABCDEF";
final String data2 = "FEDCBA9876543210";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -697,11 +701,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -713,7 +717,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -740,7 +744,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final String suffix = "/redirect";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -755,11 +759,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
{
@ -771,7 +775,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
Assert.assertEquals(1, replies.incrementAndGet());
Assert.assertTrue(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("302"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("302"));
Assert.assertTrue(replyHeaders.get("location").value().endsWith(suffix));
replyLatch.countDown();
}
@ -784,7 +788,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public void testGETWithSendError() throws Exception
{
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -797,11 +801,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -814,7 +818,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
Assert.assertEquals(1, replies.incrementAndGet());
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("404"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("404"));
replyLatch.countDown();
}
@ -833,7 +837,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
@Test
public void testGETWithException() throws Exception
{
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -844,11 +848,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch latch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -860,7 +864,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertEquals(1, replies.incrementAndGet());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("500"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("500"));
replyLatch.countDown();
if (replyInfo.isClose())
latch.countDown();
@ -883,7 +887,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
final String pangram1 = "the quick brown fox jumps over the lazy dog";
final String pangram2 = "qualche vago ione tipo zolfo, bromo, sodio";
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -901,11 +905,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(2);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -919,7 +923,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
Assert.assertEquals(1, replyFrames.incrementAndGet());
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
Assert.assertTrue(replyHeaders.get("extra").value().contains("X"));
replyLatch.countDown();
}
@ -972,7 +976,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
private void testGETWithContentByPassed(final Object content, final int length) throws Exception
{
final CountDownLatch handlerLatch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -988,11 +992,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
session.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@ -1006,7 +1010,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
Assert.assertEquals(1, replyFrames.incrementAndGet());
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -1030,7 +1034,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public void testGETWithMultipleMediumContentByPassed() throws Exception
{
final byte[] data = new byte[2048];
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -1049,11 +1053,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "GET");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "GET");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
final AtomicInteger contentLength = new AtomicInteger();
@ -1064,7 +1068,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
Assert.assertFalse(replyInfo.isClose());
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
@ -1086,7 +1090,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final byte[] data = new byte[2000];
final CountDownLatch latch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, final Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -1122,11 +1126,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
{
@ -1134,7 +1138,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
}).get(5, TimeUnit.SECONDS);
@ -1149,7 +1153,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final byte[] data = new byte[2000];
final CountDownLatch latch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, final Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -1185,11 +1189,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch replyLatch = new CountDownLatch(1);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
{
@ -1197,7 +1201,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
replyLatch.countDown();
}
}).get(5, TimeUnit.SECONDS);
@ -1213,7 +1217,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
{
final byte[] data = new byte[1000];
final CountDownLatch latch = new CountDownLatch(1);
Session session = startClient(version(), startHTTPServer(version(), new AbstractHandler()
Session session = startClient(version, startHTTPServer(version, new AbstractHandler()
{
@Override
public void handle(String target, final Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
@ -1258,11 +1262,11 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
}), null);
Headers headers = new Headers();
headers.put(HTTPSPDYHeader.METHOD.name(version()), "POST");
headers.put(HTTPSPDYHeader.URI.name(version()), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version()), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version()), "http");
headers.put(HTTPSPDYHeader.HOST.name(version()), "localhost:" + connector.getLocalPort());
headers.put(HTTPSPDYHeader.METHOD.name(version), "POST");
headers.put(HTTPSPDYHeader.URI.name(version), "/foo");
headers.put(HTTPSPDYHeader.VERSION.name(version), "HTTP/1.1");
headers.put(HTTPSPDYHeader.SCHEME.name(version), "http");
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + connector.getLocalPort());
final CountDownLatch responseLatch = new CountDownLatch(2);
Stream stream = session.syn(new SynInfo(headers, false), new StreamFrameListener.Adapter()
{
@ -1270,7 +1274,7 @@ public class ServerHTTPSPDYv2Test extends AbstractHTTPSPDYTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Headers replyHeaders = replyInfo.getHeaders();
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version())).value().contains("200"));
Assert.assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
responseLatch.countDown();
}

View File

@ -1,31 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
import org.eclipse.jetty.spdy.api.SPDY;
public class ServerHTTPSPDYv3Test extends ServerHTTPSPDYv2Test
{
@Override
protected short version()
{
return SPDY.V3;
}
}