From 7c4fd9326e2e3fbe4d868ed0b085dc4a134d7d92 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 2 Aug 2012 14:17:49 +1000 Subject: [PATCH] jetty-9 one connector passing more tests --- .../main/java/org/eclipse/jetty/proxy/ProxyServer.java | 2 +- .../eclipse/jetty/proxy/AbstractBalancerServletTest.java | 9 +++++---- .../jetty/spdy/NextProtoNegoClientAsyncConnection.java | 7 +++++++ .../jetty/spdy/NextProtoNegoServerAsyncConnection.java | 9 ++++++++- .../java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java | 7 +++++++ .../src/main/java/org/eclipse/jetty/spdy/SPDYClient.java | 2 +- .../java/org/eclipse/jetty/spdy/SPDYServerConnector.java | 6 +++--- .../jetty/spdy/ServerSPDYAsyncConnectionFactory.java | 2 +- 8 files changed, 33 insertions(+), 11 deletions(-) diff --git a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/ProxyServer.java b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/ProxyServer.java index 9e11861eaa1..94d0d506c4e 100644 --- a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/ProxyServer.java +++ b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/ProxyServer.java @@ -26,7 +26,7 @@ public class ProxyServer public static void main(String[] args) throws Exception { Server server = new Server(); - SelectChannelConnector connector = new SelectChannelConnector(); + SelectChannelConnector connector = new SelectChannelConnector(server); connector.setPort(8888); server.addConnector(connector); diff --git a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/AbstractBalancerServletTest.java b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/AbstractBalancerServletTest.java index 8af46c184e1..170bacf2269 100644 --- a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/AbstractBalancerServletTest.java +++ b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/AbstractBalancerServletTest.java @@ -23,8 +23,9 @@ import org.eclipse.jetty.http.HttpCookie; import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.proxy.BalancerServlet; +import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.eclipse.jetty.server.SelectChannelConnector; import org.eclipse.jetty.server.session.HashSessionIdManager; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -103,7 +104,7 @@ public abstract class AbstractBalancerServletTest private Server createServer(ServletHolder servletHolder, String appContext, String servletUrlPattern) { Server server = new Server(); - SelectChannelConnector httpConnector = new SelectChannelConnector(); + SelectChannelConnector httpConnector = new SelectChannelConnector(server); server.addConnector(httpConnector); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); @@ -122,9 +123,9 @@ public abstract class AbstractBalancerServletTest node.setSessionIdManager(sessionIdManager); } - private int getServerPort(Server node) + private int getServerPort(Server server) { - return node.getConnectors()[0].getLocalPort(); + return ((Connector.NetConnector)server.getConnectors()[0]).getLocalPort(); } protected byte[] sendRequestToBalancer(String requestUri) throws IOException, InterruptedException diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoClientAsyncConnection.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoClientAsyncConnection.java index 3d5e771cfba..fa5d58922de 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoClientAsyncConnection.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoClientAsyncConnection.java @@ -42,6 +42,13 @@ public class NextProtoNegoClientAsyncConnection extends AbstractAsyncConnection this.client = client; } + @Override + public void onOpen() + { + super.onOpen(); + fillInterested(); + } + @Override public void onFillable() { diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoServerAsyncConnection.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoServerAsyncConnection.java index c6e5ee96302..82329477c3b 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoServerAsyncConnection.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/NextProtoNegoServerAsyncConnection.java @@ -34,11 +34,18 @@ public class NextProtoNegoServerAsyncConnection extends AbstractAsyncConnection public NextProtoNegoServerAsyncConnection(SocketChannel channel, AsyncEndPoint endPoint, SPDYServerConnector connector) { - super(endPoint, connector.findExecutor()); + super(endPoint, connector.getExecutor()); this.channel = channel; this.connector = connector; } + @Override + public void onOpen() + { + super.onOpen(); + fillInterested(); + } + @Override public void onFillable() { diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java index c3f1e81998d..b11e62e1376 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java @@ -42,6 +42,13 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont onIdle(true); } + @Override + public void onOpen() + { + super.onOpen(); + fillInterested(); + } + @Override public void onFillable() { diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYClient.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYClient.java index bb0a1b1149b..22082b89c46 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYClient.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYClient.java @@ -345,7 +345,7 @@ public class SPDYClient } }; - AsyncEndPoint sslEndPoint = sslConnection.getSslEndPoint(); + AsyncEndPoint sslEndPoint = sslConnection.getDecryptedEndPoint(); NextProtoNegoClientAsyncConnection connection = new NextProtoNegoClientAsyncConnection(channel, sslEndPoint, attachment, client.factory.threadPool, client); sslEndPoint.setAsyncConnection(connection); connectionOpened(connection); diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYServerConnector.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYServerConnector.java index 24498c4ead1..3500d26467c 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYServerConnector.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYServerConnector.java @@ -187,7 +187,7 @@ public class SPDYServerConnector extends SelectChannelConnector if (sslContextFactory != null) { final SSLEngine engine = newSSLEngine(sslContextFactory, channel); - Executor executor = findExecutor(); + Executor executor = getExecutor(); SslConnection sslConnection = new SslConnection(bufferPool, executor, endPoint, engine) { @Override @@ -198,7 +198,7 @@ public class SPDYServerConnector extends SelectChannelConnector } }; - final AsyncEndPoint sslEndPoint = sslConnection.getSslEndPoint(); + final AsyncEndPoint sslEndPoint = sslConnection.getDecryptedEndPoint(); NextProtoNegoServerAsyncConnection connection = new NextProtoNegoServerAsyncConnection(channel, sslEndPoint, this); sslEndPoint.setAsyncConnection(connection); getSelectorManager().connectionOpened(connection); @@ -277,7 +277,7 @@ public class SPDYServerConnector extends SelectChannelConnector @Override public void execute(Runnable command) { - Executor threadPool = findExecutor(); + Executor threadPool = getExecutor(); if (threadPool == null) throw new RejectedExecutionException(); threadPool.execute(command); diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/ServerSPDYAsyncConnectionFactory.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/ServerSPDYAsyncConnectionFactory.java index 46e07b012e5..0908447e85e 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/ServerSPDYAsyncConnectionFactory.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/ServerSPDYAsyncConnectionFactory.java @@ -90,7 +90,7 @@ public class ServerSPDYAsyncConnectionFactory implements AsyncConnectionFactory private ServerSPDYAsyncConnection(AsyncEndPoint endPoint, ByteBufferPool bufferPool, Parser parser, ServerSessionFrameListener listener, SPDYServerConnector connector) { - super(endPoint, bufferPool, parser, connector.findExecutor()); + super(endPoint, bufferPool, parser, connector.getExecutor()); this.listener = listener; this.connector = connector; }