Jetty9 - Fixed tests: now creating a connector requires an instance of Server, otherwise throws an NPE.
This commit is contained in:
parent
9a1a020f0e
commit
7b58c584b9
|
@ -61,11 +61,10 @@ public abstract class AbstractTest
|
||||||
|
|
||||||
protected InetSocketAddress startServer(short version, ServerSessionFrameListener listener) throws Exception
|
protected InetSocketAddress startServer(short version, ServerSessionFrameListener listener) throws Exception
|
||||||
{
|
{
|
||||||
QueuedThreadPool pool = new QueuedThreadPool();
|
if (server == null)
|
||||||
pool.setName(pool.getName()+"-server");
|
server = newServer();
|
||||||
server = new Server(pool);
|
|
||||||
if (connector == null)
|
if (connector == null)
|
||||||
connector = newSPDYServerConnector(listener);
|
connector = newSPDYServerConnector(server, listener);
|
||||||
if (listener == null)
|
if (listener == null)
|
||||||
listener = connector.getServerSessionFrameListener();
|
listener = connector.getServerSessionFrameListener();
|
||||||
connector.setDefaultConnectionFactory(new ServerSPDYConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), listener));
|
connector.setDefaultConnectionFactory(new ServerSPDYConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), listener));
|
||||||
|
@ -75,7 +74,14 @@ public abstract class AbstractTest
|
||||||
return new InetSocketAddress("localhost", connector.getLocalPort());
|
return new InetSocketAddress("localhost", connector.getLocalPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SPDYServerConnector newSPDYServerConnector(ServerSessionFrameListener listener)
|
protected Server newServer()
|
||||||
|
{
|
||||||
|
QueuedThreadPool pool = new QueuedThreadPool();
|
||||||
|
pool.setName(pool.getName()+"-server");
|
||||||
|
return new Server(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SPDYServerConnector newSPDYServerConnector(Server server, ServerSessionFrameListener listener)
|
||||||
{
|
{
|
||||||
return new SPDYServerConnector(server, listener);
|
return new SPDYServerConnector(server, listener);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,8 @@ public class IdleTimeoutTest extends AbstractTest
|
||||||
@Test
|
@Test
|
||||||
public void testServerEnforcingIdleTimeout() throws Exception
|
public void testServerEnforcingIdleTimeout() throws Exception
|
||||||
{
|
{
|
||||||
connector = newSPDYServerConnector(new ServerSessionFrameListener.Adapter()
|
server = newServer();
|
||||||
|
connector = newSPDYServerConnector(server, new ServerSessionFrameListener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
|
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
|
||||||
|
@ -73,7 +74,8 @@ public class IdleTimeoutTest extends AbstractTest
|
||||||
@Test
|
@Test
|
||||||
public void testServerEnforcingIdleTimeoutWithUnrespondedStream() throws Exception
|
public void testServerEnforcingIdleTimeoutWithUnrespondedStream() throws Exception
|
||||||
{
|
{
|
||||||
connector = newSPDYServerConnector(null);
|
server = newServer();
|
||||||
|
connector = newSPDYServerConnector(server, null);
|
||||||
connector.setIdleTimeout(idleTimeout);
|
connector.setIdleTimeout(idleTimeout);
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
@ -95,7 +97,8 @@ public class IdleTimeoutTest extends AbstractTest
|
||||||
@Test
|
@Test
|
||||||
public void testServerNotEnforcingIdleTimeoutWithPendingStream() throws Exception
|
public void testServerNotEnforcingIdleTimeoutWithPendingStream() throws Exception
|
||||||
{
|
{
|
||||||
connector = newSPDYServerConnector(new ServerSessionFrameListener.Adapter()
|
server = newServer();
|
||||||
|
connector = newSPDYServerConnector(server, new ServerSessionFrameListener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
|
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.jetty.npn.NextProtoNego;
|
import org.eclipse.jetty.npn.NextProtoNego;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.spdy.api.Session;
|
import org.eclipse.jetty.spdy.api.Session;
|
||||||
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
|
@ -33,7 +34,7 @@ import org.junit.Test;
|
||||||
public class SSLEngineLeakTest extends AbstractTest
|
public class SSLEngineLeakTest extends AbstractTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected SPDYServerConnector newSPDYServerConnector(ServerSessionFrameListener listener)
|
protected SPDYServerConnector newSPDYServerConnector(Server server, ServerSessionFrameListener listener)
|
||||||
{
|
{
|
||||||
SslContextFactory sslContextFactory = newSslContextFactory();
|
SslContextFactory sslContextFactory = newSslContextFactory();
|
||||||
return new SPDYServerConnector(server, sslContextFactory, listener);
|
return new SPDYServerConnector(server, sslContextFactory, listener);
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.eclipse.jetty.spdy;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import org.eclipse.jetty.npn.NextProtoNego;
|
import org.eclipse.jetty.npn.NextProtoNego;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -29,7 +30,7 @@ import org.junit.Before;
|
||||||
public class SSLSynReplyTest extends SynReplyTest
|
public class SSLSynReplyTest extends SynReplyTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected SPDYServerConnector newSPDYServerConnector(ServerSessionFrameListener listener)
|
protected SPDYServerConnector newSPDYServerConnector(Server server, ServerSessionFrameListener listener)
|
||||||
{
|
{
|
||||||
SslContextFactory sslContextFactory = newSslContextFactory();
|
SslContextFactory sslContextFactory = newSslContextFactory();
|
||||||
return new SPDYServerConnector(server, sslContextFactory, listener);
|
return new SPDYServerConnector(server, sslContextFactory, listener);
|
||||||
|
|
Loading…
Reference in New Issue