jetty-9 one connector passing more tests
This commit is contained in:
parent
96b5c05674
commit
7c4fd9326e
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -42,6 +42,13 @@ public class NextProtoNegoClientAsyncConnection extends AbstractAsyncConnection
|
|||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen()
|
||||
{
|
||||
super.onOpen();
|
||||
fillInterested();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFillable()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -42,6 +42,13 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont
|
|||
onIdle(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen()
|
||||
{
|
||||
super.onOpen();
|
||||
fillInterested();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFillable()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue