Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2012-08-02 07:44:29 +0000
committerGreg Wilkins2012-08-02 07:44:29 +0000
commitb63e09df616ffbd68bb59fb46472909b07e0230b (patch)
tree7028be7d538a66cbc76cd8c7845dde1e638d7a61
parentb52930be14eb743de039d1d8614267b2d62c4930 (diff)
downloadorg.eclipse.jetty.project-b63e09df616ffbd68bb59fb46472909b07e0230b.tar.gz
org.eclipse.jetty.project-b63e09df616ffbd68bb59fb46472909b07e0230b.tar.xz
org.eclipse.jetty.project-b63e09df616ffbd68bb59fb46472909b07e0230b.zip
jetty-9 rudimentary connectionFactory impl
-rw-r--r--example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java4
-rw-r--r--example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java2
-rw-r--r--jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java13
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java85
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetConnector.java20
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionFactory.java92
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionStatistics.java13
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java8
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java21
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java27
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/nio/NetworkTrafficSelectChannelConnector.java16
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/CheckReverseProxyHeadersTest.java2
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java4
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java10
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java9
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java2
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java1
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java6
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java7
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java4
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SelectChannelServerSslTest.java7
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslBytesServerTest.java2
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java7
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java9
-rw-r--r--jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java2
-rw-r--r--jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java4
-rw-r--r--jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java2
-rw-r--r--test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java30
28 files changed, 223 insertions, 186 deletions
diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java
index 443a26dd3f..294b235320 100644
--- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java
+++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java
@@ -60,7 +60,7 @@ public class LikeJettyXml
SelectChannelConnector connector = new SelectChannelConnector(server);
connector.setPort(8080);
connector.setIdleTimeout(30000);
- connector.getHttpConfig().setConfidentialPort(8443);
+ connector.getConnectionFactory().getHttpConfig().setConfidentialPort(8443);
// TODO connector.setStatsOn(false);
server.setConnectors(new Connector[]
@@ -68,7 +68,7 @@ public class LikeJettyXml
SelectChannelConnector ssl_connector = new SelectChannelConnector(server,true);
ssl_connector.setPort(8443);
- SslContextFactory cf = ssl_connector.getSslContextFactory();
+ SslContextFactory cf = ssl_connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(jetty_home + "/etc/keystore");
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java
index 44898a59cd..ddf5a79902 100644
--- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java
+++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java
@@ -42,7 +42,7 @@ public class ManyConnectors
String jetty_home = System.getProperty("jetty.home","../jetty-distribution/target/distribution");
System.setProperty("jetty.home",jetty_home);
ssl_connector.setPort(8443);
- SslContextFactory cf = ssl_connector.getSslContextFactory();
+ SslContextFactory cf = ssl_connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(jetty_home + "/etc/keystore");
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
index 3757f584a7..1f1204549e 100644
--- a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
+++ b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
@@ -57,11 +57,12 @@ public class DataConstraintsTest
_server = new Server();
_connector = new LocalConnector(_server);
_connector.setIdleTimeout(300000);
- _connector.getHttpConfig().setIntegralPort(9998);
- _connector.getHttpConfig().setIntegralScheme("FTP");
- _connector.getHttpConfig().setConfidentialPort(9999);
- _connector.getHttpConfig().setConfidentialScheme("SPDY");
- _connectorS = new LocalConnector(_server,new HttpConfiguration(null,false)
+ _connector.getConnectionFactory().getHttpConfig().setIntegralPort(9998);
+ _connector.getConnectionFactory().getHttpConfig().setIntegralScheme("FTP");
+ _connector.getConnectionFactory().getHttpConfig().setConfidentialPort(9999);
+ _connector.getConnectionFactory().getHttpConfig().setConfidentialScheme("SPDY");
+ _connectorS = new LocalConnector(_server,
+ new HttpConfiguration(null,false)
{
@Override
public void customize(Request request) throws IOException
@@ -82,7 +83,7 @@ public class DataConstraintsTest
{
return true;
}
- },null,null,null,null,false,0);
+ });
_server.setConnectors(new Connector[]{_connector,_connectorS});
ContextHandler _context = new ContextHandler();
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
index dec6bd341e..5265f08c51 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
@@ -50,18 +50,12 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
protected final Logger LOG = Log.getLogger(getClass());
private final Statistics _stats = new ConnectionStatistics();
+ private final ConnectionFactory _connectionFactory;
private final Thread[] _acceptors;
private final Executor _executor;
private final ScheduledExecutorService _scheduler;
private final Server _server;
private final ByteBufferPool _byteBufferPool;
- private final boolean _ssl;
- private final SslContextFactory _sslContextFactory;
-
- /**
- * @deprecated Make this part of pluggable factory
- */
- private final HttpConfiguration _httpConfig;
private volatile String _name;
private volatile int _acceptQueueSize = 128;
@@ -69,41 +63,21 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
private volatile long _idleTimeout = 200000;
private volatile int _soLingerTime = -1;
- public AbstractConnector(@Name("server") Server server)
- {
- this(server,null);
- }
-
- public AbstractConnector(Server server,SslContextFactory sslContextFactory)
- {
- this(server,null,null,null,null, sslContextFactory, sslContextFactory!=null, 0);
- }
-
- public AbstractConnector(Server server,boolean ssl)
- {
- this(server,null,null,null,null, ssl?new SslContextFactory():null, ssl, 0);
- }
-
-
/* ------------------------------------------------------------ */
/**
* @param server The server this connector will be added to. Must not be null.
- * @param httpConfig TODO
+ * @param connectionFactory ConnectionFactory or null for default
* @param executor An executor for this connector or null to use the servers executor
* @param scheduler A scheduler for this connector or null to use the servers scheduler
* @param pool A buffer pool for this connector or null to use a default {@link ByteBufferPool}
- * @param sslContextFactory An SslContextFactory to use or null if no ssl is required or to use default {@link SslContextFactory}
- * @param ssl If true, then new connections will assumed to be SSL. If false, connections can only become SSL if they upgrade and a SslContextFactory is passed.
* @param acceptors the number of acceptor threads to use, or 0 for a default value.
*/
public AbstractConnector(
Server server,
- HttpConfiguration httpConfig,
+ ConnectionFactory connectionFactory,
Executor executor,
ScheduledExecutorService scheduler,
- ByteBufferPool pool,
- SslContextFactory sslContextFactory,
- boolean ssl, int acceptors)
+ ByteBufferPool pool, int acceptors)
{
_server=server;
_executor=executor!=null?executor:_server.getThreadPool();
@@ -117,25 +91,13 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
});
_byteBufferPool = pool!=null?pool:new StandardByteBufferPool();
- _ssl=ssl;
- _sslContextFactory=sslContextFactory!=null?sslContextFactory:(ssl?new SslContextFactory(SslContextFactory.DEFAULT_KEYSTORE_PATH):null);
-
- // TODO make this pluggable
- _httpConfig = httpConfig!=null?httpConfig:new HttpConfiguration(_sslContextFactory,ssl);
+ _connectionFactory=connectionFactory!=null?connectionFactory:new ConnectionFactory();
addBean(_server,false);
addBean(_executor,executor==null);
addBean(_scheduler,scheduler==null);
addBean(_byteBufferPool,pool==null);
- if (_sslContextFactory!=null)
- addBean(_sslContextFactory,sslContextFactory==null);
-
- if (_sslContextFactory!=null)
- {
- addBean(_sslContextFactory,false);
- setSoLingerTime(30000);
- }
- addBean(_httpConfig,httpConfig==null);
+ addBean(_connectionFactory,connectionFactory!=null);
if (acceptors<=0)
acceptors=Math.max(1,(Runtime.getRuntime().availableProcessors()) / 4);
@@ -155,7 +117,13 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
{
return _server;
}
-
+
+ @Override
+ public ConnectionFactory getConnectionFactory()
+ {
+ return _connectionFactory;
+ }
+
@Override
public Executor getExecutor()
{
@@ -168,33 +136,6 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
return _byteBufferPool;
}
- @Override
- public SslContextFactory getSslContextFactory()
- {
- return _sslContextFactory;
- }
-
- public HttpConfiguration getHttpConfig()
- {
- return _httpConfig;
- }
-
- protected Connection newConnection(EndPoint endp) throws IOException
- {
- // TODO make this a plugable configurable connection factory for HTTP, HTTPS, SPDY & Websocket
-
- if (_ssl)
- {
- SSLEngine engine = _sslContextFactory.createSSLEngine(endp.getRemoteAddress());
- SslConnection ssl_connection = new SslConnection(getByteBufferPool(), getExecutor(), endp, engine);
-
- Connection http_connection = new HttpConnection(_httpConfig,this,ssl_connection.getDecryptedEndPoint());
- ssl_connection.getDecryptedEndPoint().setConnection(http_connection);
- return ssl_connection;
- }
- return new HttpConnection(_httpConfig,this,endp);
- }
-
/**
* @return Returns the maxIdleTime.
*/
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetConnector.java
index 3271ffa052..96aee4a750 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetConnector.java
@@ -25,25 +25,9 @@ public abstract class AbstractNetConnector extends AbstractConnector implements
private volatile String _host;
private volatile int _port = 0;
- public AbstractNetConnector(Server server, boolean ssl)
+ public AbstractNetConnector(Server server, ConnectionFactory connectionFactory, Executor executor, ScheduledExecutorService scheduler, ByteBufferPool pool, int acceptors)
{
- super(server,ssl);
- }
-
- public AbstractNetConnector(Server server, Executor executor, ScheduledExecutorService scheduler, ByteBufferPool pool, SslContextFactory sslContextFactory,
- boolean ssl, int acceptors)
- {
- super(server,null,executor,scheduler,pool,sslContextFactory,ssl, acceptors);
- }
-
- public AbstractNetConnector(Server server, SslContextFactory sslContextFactory)
- {
- super(server,sslContextFactory);
- }
-
- public AbstractNetConnector(Server server)
- {
- super(server);
+ super(server,connectionFactory,executor,scheduler,pool, acceptors);
}
public void setHost(String host)
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionFactory.java
new file mode 100644
index 0000000000..587ba965fc
--- /dev/null
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionFactory.java
@@ -0,0 +1,92 @@
+// ========================================================================
+// Copyright (c) 2004-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.server;
+
+import java.io.IOException;
+
+import javax.net.ssl.SSLEngine;
+
+import org.eclipse.jetty.io.Connection;
+import org.eclipse.jetty.io.EndPoint;
+import org.eclipse.jetty.io.ssl.SslConnection;
+import org.eclipse.jetty.util.component.AggregateLifeCycle;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+// TODO This is just a place holder for a real factory
+public class ConnectionFactory extends AggregateLifeCycle
+{
+ private final boolean _ssl;
+ private final SslContextFactory _sslContextFactory;
+
+
+ // TODO Make this part of pluggable factory
+ private final HttpConfiguration _httpConfig;
+
+
+ ConnectionFactory()
+ {
+ this(null,false);
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @param sslContextFactory An SslContextFactory to use or null if no ssl is required or to use default {@link SslContextFactory}
+ * @param ssl If true, then new connections will assumed to be SSL. If false, connections can only become SSL if they upgrade and a SslContextFactory is passed.
+ */
+ ConnectionFactory(SslContextFactory sslContextFactory, boolean ssl)
+ {
+ this(null,sslContextFactory,ssl);
+ }
+
+ ConnectionFactory(HttpConfiguration httpConfig, SslContextFactory sslContextFactory, boolean ssl)
+ {
+ _ssl=ssl;
+ _sslContextFactory=sslContextFactory!=null?sslContextFactory:(ssl?new SslContextFactory(SslContextFactory.DEFAULT_KEYSTORE_PATH):null);
+
+ addBean(_sslContextFactory,sslContextFactory==null);
+
+ // TODO make this pluggable
+ _httpConfig = httpConfig!=null?httpConfig:new HttpConfiguration(_sslContextFactory,ssl);
+ addBean(_httpConfig,httpConfig==null);
+
+ }
+
+
+ protected Connection newConnection(Connector connector,EndPoint endp) throws IOException
+ {
+
+ if (_ssl)
+ {
+ SSLEngine engine = _sslContextFactory.createSSLEngine(endp.getRemoteAddress());
+ SslConnection ssl_connection = new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endp, engine);
+
+ Connection http_connection = new HttpConnection(_httpConfig,connector,ssl_connection.getDecryptedEndPoint());
+ ssl_connection.getDecryptedEndPoint().setConnection(http_connection);
+ return ssl_connection;
+ }
+ return new HttpConnection(_httpConfig,connector,endp);
+ }
+
+ public SslContextFactory getSslContextFactory()
+ {
+ return _sslContextFactory;
+ }
+
+ public HttpConfiguration getHttpConfig()
+ {
+ return _httpConfig;
+ }
+
+
+}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionStatistics.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionStatistics.java
index dcbf548676..534653d2de 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionStatistics.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionStatistics.java
@@ -1,3 +1,16 @@
+// ========================================================================
+// Copyright (c) 2004-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.server;
import java.util.concurrent.atomic.AtomicLong;
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java
index 173e4ac686..e29f002003 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java
@@ -1,5 +1,5 @@
// ========================================================================
-// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
+// Copyright (c) 2004-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
@@ -44,6 +44,9 @@ public interface Connector extends LifeCycle
Server getServer();
/* ------------------------------------------------------------ */
+ ConnectionFactory getConnectionFactory();
+
+ /* ------------------------------------------------------------ */
Executor getExecutor();
/* ------------------------------------------------------------ */
@@ -53,9 +56,6 @@ public interface Connector extends LifeCycle
ByteBufferPool getByteBufferPool();
/* ------------------------------------------------------------ */
- SslContextFactory getSslContextFactory();
-
- /* ------------------------------------------------------------ */
/**
* @return Max Idle time for connections in milliseconds
*/
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java
index fff6c558ef..f197e50aa5 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java
@@ -39,26 +39,31 @@ public class LocalConnector extends AbstractConnector
public LocalConnector(Server server)
{
- super(server,null,null,null,null, null,false, -1);
+ this(server,null,null,null,null, -1);
}
public LocalConnector(Server server, boolean ssl)
{
- super(server,ssl);
+ this(server,new ConnectionFactory(null,ssl),null,null,null,0);
+ manage(getConnectionFactory());
}
- public LocalConnector(Server server, HttpConfiguration httpConfig, Executor executor, ScheduledExecutorService scheduler, ByteBufferPool pool,
- SslContextFactory sslContextFactory, boolean ssl, int acceptors)
+ public LocalConnector(Server server, HttpConfiguration httpConfig)
{
- super(server,httpConfig,executor,scheduler,pool,sslContextFactory,ssl, acceptors);
+ this(server,new ConnectionFactory(httpConfig,null,false),null,null,null,0);
+ manage(getConnectionFactory());
}
public LocalConnector(Server server, SslContextFactory sslContextFactory)
{
- super(server,sslContextFactory);
+ this(server,new ConnectionFactory(sslContextFactory,sslContextFactory!=null),null,null,null,0);
+ manage(getConnectionFactory());
}
-
+
+ public LocalConnector(Server server, ConnectionFactory connectionFactory, Executor executor, ScheduledExecutorService scheduler, ByteBufferPool pool,
+ int acceptors)
{
+ super(server,connectionFactory,executor,scheduler,pool,acceptors);
setIdleTimeout(30000);
}
@@ -158,7 +163,7 @@ public class LocalConnector extends AbstractConnector
{
LOG.debug("accepting {}",acceptorID);
LocalEndPoint endp = _connects.take();
- Connection connection=newConnection(endp);
+ Connection connection=getConnectionFactory().newConnection(LocalConnector.this,endp);
endp.setConnection(connection);
endp.onOpen();
connection.onOpen();
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java
index 65664afde4..f2aad4ba14 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java
@@ -66,21 +66,29 @@ public class SelectChannelConnector extends AbstractNetConnector
/* ------------------------------------------------------------ */
public SelectChannelConnector(Server server)
{
- this(server,null,null,null,null,false,0,0);
+ this(server,null,null,null,null,0,0);
}
/* ------------------------------------------------------------ */
public SelectChannelConnector(Server server, boolean ssl)
{
- this(server,null,null,null,null,ssl,0,0);
+ this(server,new ConnectionFactory(null,ssl));
+ manage(getConnectionFactory());
}
/* ------------------------------------------------------------ */
public SelectChannelConnector(Server server, SslContextFactory sslContextFactory)
{
- this(server,null,null,null,sslContextFactory,sslContextFactory!=null,0,0);
+ this(server,new ConnectionFactory(sslContextFactory,sslContextFactory!=null));
+ manage(getConnectionFactory());
}
+
+ /* ------------------------------------------------------------ */
+ public SelectChannelConnector(Server server, ConnectionFactory connectionFactory)
+ {
+ this(server,connectionFactory,null,null,null,0,0);
+ }
/* ------------------------------------------------------------ */
/**
@@ -88,23 +96,24 @@ public class SelectChannelConnector extends AbstractNetConnector
* @param executor An executor for this connector or null to use the servers executor
* @param scheduler A scheduler for this connector or null to use the servers scheduler
* @param pool A buffer pool for this connector or null to use a default {@link ByteBufferPool}
- * @param sslContextFactory An SslContextFactory to use or null if no ssl is required or to use default {@link SslContextFactory}
- * @param ssl If true, then new connections will assumed to be SSL. If false, connections can only become SSL if they upgrade and a SslContextFactory is passed.
* @param acceptors the number of acceptor threads to use, or 0 for a default value.
*/
public SelectChannelConnector(
@Name("server") Server server,
+ @Name("connectionFactory") ConnectionFactory connectionFactory,
@Name("executor") Executor executor,
@Name("scheduler") ScheduledExecutorService scheduler,
@Name("bufferPool") ByteBufferPool pool,
- @Name("sslContextFactory") SslContextFactory sslContextFactory,
- @Name("ssl") boolean ssl,
@Name("acceptors") int acceptors,
@Name("selectors") int selectors)
{
- super(server,executor,scheduler,pool,sslContextFactory,ssl,acceptors);
+ super(server,connectionFactory,executor,scheduler,pool,acceptors);
_manager=new ConnectorSelectorManager(selectors!=0?selectors:Math.max(1,(Runtime.getRuntime().availableProcessors())/4));
addBean(_manager,true);
+
+ // TODO yuck
+ if (getConnectionFactory().getSslContextFactory()!=null)
+ setSoLingerTime(30000);
}
@@ -287,7 +296,7 @@ public class SelectChannelConnector extends AbstractNetConnector
@Override
public Connection newConnection(SocketChannel channel, EndPoint endpoint, Object attachment) throws IOException
{
- return SelectChannelConnector.this.newConnection(endpoint);
+ return getConnectionFactory().newConnection(SelectChannelConnector.this,endpoint);
}
}
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/NetworkTrafficSelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/NetworkTrafficSelectChannelConnector.java
index 163fae4e8b..2fb12a867b 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/NetworkTrafficSelectChannelConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/NetworkTrafficSelectChannelConnector.java
@@ -41,22 +41,6 @@ public class NetworkTrafficSelectChannelConnector extends SelectChannelConnector
{
private final List<NetworkTrafficListener> listeners = new CopyOnWriteArrayList<NetworkTrafficListener>();
-
- public NetworkTrafficSelectChannelConnector(Server server, boolean ssl)
- {
- super(server,ssl);
- }
-
- public NetworkTrafficSelectChannelConnector(Server server, Executor executor, ScheduledExecutorService scheduler, ByteBufferPool pool,
- SslContextFactory sslContextFactory, boolean ssl, int acceptors, int selectors)
- {
- super(server,executor,scheduler,pool,sslContextFactory,ssl,acceptors,selectors);
- }
-
- public NetworkTrafficSelectChannelConnector(Server server, SslContextFactory sslContextFactory)
- {
- super(server,sslContextFactory);
- }
public NetworkTrafficSelectChannelConnector(Server server)
{
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CheckReverseProxyHeadersTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CheckReverseProxyHeadersTest.java
index dbe6c5503c..04bcc87371 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/CheckReverseProxyHeadersTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CheckReverseProxyHeadersTest.java
@@ -96,7 +96,7 @@ public class CheckReverseProxyHeadersTest
LocalConnector connector = new LocalConnector(server);
// Activate reverse proxy headers checking
- connector.getHttpConfig().setForwarded(true);
+ connector.getConnectionFactory().getHttpConfig().setForwarded(true);
server.setConnectors(new Connector[] {connector});
ValidationHandler validationHandler = new ValidationHandler(requestValidator);
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java
index 0a74f7f9a7..61952dc3b4 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java
@@ -61,8 +61,8 @@ public class HttpConnectionTest
server = new Server();
connector = new LocalConnector(server);
server.addConnector(connector);
- connector.getHttpConfig().setRequestHeaderSize(1024);
- connector.getHttpConfig().setResponseHeaderSize(1024);
+ connector.getConnectionFactory().getHttpConfig().setRequestHeaderSize(1024);
+ connector.getConnectionFactory().getHttpConfig().setResponseHeaderSize(1024);
server.setHandler(new DumpHandler());
server.start();
}
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
index 08f5dca2ff..0ab25758fe 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
@@ -64,11 +64,11 @@ public class RequestTest
{
_server = new Server();
_connector = new LocalConnector(_server);
- _connector.getHttpConfig().setRequestHeaderSize(512);
- _connector.getHttpConfig().setRequestBufferSize(1024);
- _connector.getHttpConfig().setResponseHeaderSize(512);
- _connector.getHttpConfig().setResponseBufferSize(2048);
- _connector.getHttpConfig().setForwarded(true);
+ _connector.getConnectionFactory().getHttpConfig().setRequestHeaderSize(512);
+ _connector.getConnectionFactory().getHttpConfig().setRequestBufferSize(1024);
+ _connector.getConnectionFactory().getHttpConfig().setResponseHeaderSize(512);
+ _connector.getConnectionFactory().getHttpConfig().setResponseBufferSize(2048);
+ _connector.getConnectionFactory().getHttpConfig().setForwarded(true);
_server.addConnector(_connector);
_handler = new RequestHandler();
_server.setHandler(_handler);
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java
index 6ea4395156..3548f515f3 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java
@@ -43,12 +43,12 @@ public class SlowClientWithPipelinedRequestTest
public void startServer(Handler handler) throws Exception
{
server = new Server();
- connector = new SelectChannelConnector(server)
+ connector = new SelectChannelConnector(server,new ConnectionFactory()
{
@Override
- protected Connection newConnection(EndPoint endpoint)
+ protected Connection newConnection(Connector connector,EndPoint endpoint)
{
- return new HttpConnection(getHttpConfig(),this,endpoint)
+ return new HttpConnection(getHttpConfig(),connector,endpoint)
{
@Override
public synchronized void onFillable()
@@ -58,7 +58,8 @@ public class SlowClientWithPipelinedRequestTest
}
};
}
- };
+ },null,null,null,0,0);
+
server.addConnector(connector);
connector.setPort(0);
server.setHandler(handler);
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java
index ec596efb81..de79f21b89 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java
@@ -86,7 +86,7 @@ public class StressTest
_threads.setMaxThreads(200);
_server = new Server(_threads);
- _connector = new SelectChannelConnector(_server,null,null,null,null,false,1,1);
+ _connector = new SelectChannelConnector(_server,null,null,null,null,1,1);
_connector.setAcceptQueueSize(5000);
_connector.setIdleTimeout(30000);
_server.addConnector(_connector);
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java
index 0b10ce06b5..b16bde8440 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java
@@ -380,6 +380,7 @@ public class ContextHandlerTest
Assert.assertTrue(response.indexOf("Goodbye")>0);
Assert.assertTrue(response.indexOf("dead")<0);
+ Thread.sleep(100);
Assert.assertTrue(handler.error);
Assert.assertTrue(handler.throwable!=null);
}
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java
index 3d400806f0..7fd1acd5d4 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java
@@ -78,9 +78,9 @@ public class SSLCloseTest extends TestCase
String keystore = System.getProperty("user.dir")+File.separator+"src"+File.separator+"test"+File.separator+"resources"+File.separator+"keystore";
connector.setPort(0);
- connector.getSslContextFactory().setKeyStorePath(keystore);
- connector.getSslContextFactory().setKeyStorePassword("storepwd");
- connector.getSslContextFactory().setKeyManagerPassword("keypwd");
+ connector.getConnectionFactory().getSslContextFactory().setKeyStorePath(keystore);
+ connector.getConnectionFactory().getSslContextFactory().setKeyStorePassword("storepwd");
+ connector.getConnectionFactory().getSslContextFactory().setKeyManagerPassword("keypwd");
server.setConnectors(new Connector[]
{ connector });
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java
index 51cb7bfd3c..171295a6da 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java
@@ -94,12 +94,12 @@ public class SSLEngineTest
String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath();
connector.setPort(0);
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keystore);
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
- connector.getHttpConfig().setRequestBufferSize(512);
- connector.getHttpConfig().setRequestHeaderSize(512);
+ connector.getConnectionFactory().getHttpConfig().setRequestBufferSize(512);
+ connector.getConnectionFactory().getHttpConfig().setRequestHeaderSize(512);
server.setConnectors(new Connector[]{connector });
}
@@ -117,6 +117,7 @@ public class SSLEngineTest
{
server.setHandler(new HelloWorldHandler());
server.start();
+ server.dumpStdErr();
SSLContext ctx=SSLContext.getInstance("TLS");
ctx.init(null,SslContextFactory.TRUST_ALL_CERTS,new java.security.SecureRandom());
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java
index 7a040825aa..dc7d7c6562 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java
@@ -56,7 +56,7 @@ public class SSLSelectChannelConnectorLoadTest
server.addConnector(connector);
String keystorePath = System.getProperty("basedir", ".") + "/src/test/resources/keystore";
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keystorePath);
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
@@ -68,7 +68,7 @@ public class SSLSelectChannelConnectorLoadTest
server.start();
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
- keystore.load(new FileInputStream(connector.getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
+ keystore.load(new FileInputStream(connector.getConnectionFactory().getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(keystore);
sslContext = SSLContext.getInstance("SSL");
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SelectChannelServerSslTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SelectChannelServerSslTest.java
index c50ac8584c..0068144bc1 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SelectChannelServerSslTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SelectChannelServerSslTest.java
@@ -25,6 +25,7 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import org.eclipse.jetty.server.HttpServerTestBase;
+import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -49,10 +50,10 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
@BeforeClass
public static void init() throws Exception
{
- SslSelectChannelConnector connector = new SslSelectChannelConnector(_server);
+ SelectChannelConnector connector = new SelectChannelConnector(_server,true);
String keystorePath = System.getProperty("basedir",".") + "/src/test/resources/keystore";
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keystorePath);
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
@@ -62,7 +63,7 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
- keystore.load(new FileInputStream(connector.getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
+ keystore.load(new FileInputStream(connector.getConnectionFactory().getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(keystore);
__sslContext = SSLContext.getInstance("TLS");
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslBytesServerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslBytesServerTest.java
index d1cd8189f9..56b449e606 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslBytesServerTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslBytesServerTest.java
@@ -99,7 +99,7 @@ public class SslBytesServerTest extends SslBytesTest
connector.setPort(0);
File keyStore = MavenTestingUtils.getTestResourceFile("keystore");
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keyStore.getAbsolutePath());
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java
index d3ec4836f7..07b4f0457f 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java
@@ -21,6 +21,7 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import org.eclipse.jetty.server.ConnectorTimeoutTest;
+import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.BeforeClass;
@@ -37,10 +38,10 @@ public class SslSelectChannelTimeoutTest extends ConnectorTimeoutTest
@BeforeClass
public static void init() throws Exception
{
- SslSelectChannelConnector connector = new SslSelectChannelConnector(_server);
+ SelectChannelConnector connector = new SelectChannelConnector(_server,true);
connector.setIdleTimeout(MAX_IDLE_TIME); //250 msec max idle
String keystorePath = System.getProperty("basedir",".") + "/src/test/resources/keystore";
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keystorePath);
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
@@ -49,7 +50,7 @@ public class SslSelectChannelTimeoutTest extends ConnectorTimeoutTest
startServer(connector);
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
- keystore.load(new FileInputStream(connector.getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
+ keystore.load(new FileInputStream(connector.getConnectionFactory().getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(keystore);
__sslContext = SSLContext.getInstance("SSL");
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
index a392be8aeb..bc5f87d68e 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.IO;
@@ -47,18 +48,18 @@ import org.junit.Test;
public class SslUploadTest
{
private static Server server;
- private static SslSelectChannelConnector connector;
+ private static SelectChannelConnector connector;
private static int total;
@BeforeClass
public static void startServer() throws Exception
{
server = new Server();
- connector = new SslSelectChannelConnector(server);
+ connector = new SelectChannelConnector(server,true);
server.addConnector(connector);
String keystorePath = System.getProperty("basedir",".") + "/src/test/resources/keystore";
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(keystorePath);
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
@@ -82,7 +83,7 @@ public class SslUploadTest
public void test() throws Exception
{
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
- keystore.load(new FileInputStream(connector.getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
+ keystore.load(new FileInputStream(connector.getConnectionFactory().getSslContextFactory().getKeyStorePath()), "storepwd".toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(keystore);
SSLContext sslContext = SSLContext.getInstance("SSL");
diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java
index 2b7189c1ad..8dc81ca8c6 100644
--- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java
+++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java
@@ -23,7 +23,7 @@ import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
-public class EmptyEndPoint implements EndPoint
+public class EmptyAsyncEndPoint implements EndPoint
{
private boolean checkForIdle;
private Connection connection;
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java
index 714e255153..0d609ddcb8 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java
@@ -1392,6 +1392,8 @@ public class SslContextFactory extends AbstractLifeCycle
/* ------------------------------------------------------------ */
public SSLEngine newSslEngine(String host,int port)
{
+ if (!isRunning())
+ throw new IllegalStateException("!STARTED");
SSLEngine sslEngine=isSessionCachingEnabled()
?_context.createSSLEngine(host, port)
:_context.createSSLEngine();
@@ -1403,6 +1405,8 @@ public class SslContextFactory extends AbstractLifeCycle
/* ------------------------------------------------------------ */
public SSLEngine newSslEngine()
{
+ if (!isRunning())
+ throw new IllegalStateException("!STARTED");
SSLEngine sslEngine=_context.createSSLEngine();
customize(sslEngine);
return sslEngine;
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java
index 3f09953a55..971ff14b7b 100644
--- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java
@@ -98,7 +98,7 @@ public class WebSocketOverSSLTest
_server = new Server();
SelectChannelConnector connector = new SelectChannelConnector(_server,true);
_server.addConnector(connector);
- SslContextFactory cf = connector.getSslContextFactory();
+ SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath());
cf.setKeyStorePassword("storepwd");
cf.setKeyManagerPassword("keypwd");
diff --git a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java
index 784c622740..fc7211f110 100644
--- a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java
+++ b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java
@@ -56,7 +56,12 @@ public class TestServer
String jetty_root = "..";
- Server server = new Server();
+ // Setup Threadpool
+ QueuedThreadPool threadPool = new QueuedThreadPool();
+ threadPool.setMaxThreads(100);
+
+ // Setup server
+ Server server = new Server(threadPool);
server.setSendDateHeader(true);
// Setup JMX
@@ -65,30 +70,23 @@ public class TestServer
server.addBean(mbContainer);
mbContainer.addBean(Log.getLog());
- // Setup Threadpool
- QueuedThreadPool threadPool = new QueuedThreadPool();
- threadPool.setMaxThreads(100);
- server.setThreadPool(threadPool);
-
// Setup Connectors
- SelectChannelConnector connector0 = new SelectChannelConnector();
+ SelectChannelConnector connector0 = new SelectChannelConnector(server);
connector0.setPort(8080);
- connector0.setMaxIdleTime(30000);
- connector0.setConfidentialPort(8443);
+ connector0.setIdleTimeout(30000);
+ connector0.getConnectionFactory().getHttpConfig().setConfidentialPort(8443);
server.addConnector(connector0);
// Setup Connectors
- SelectChannelConnector connector1 = new SelectChannelConnector();
+ SelectChannelConnector connector1 = new SelectChannelConnector(server);
connector1.setPort(8081);
- connector1.setMaxIdleTime(30000);
- connector1.setConfidentialPort(8443);
+ connector0.setIdleTimeout(30000);
+ connector1.getConnectionFactory().getHttpConfig().setConfidentialPort(8443);
server.addConnector(connector1);
-
-
- SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
+ SelectChannelConnector ssl_connector = new SelectChannelConnector(server,true);
ssl_connector.setPort(8443);
- SslContextFactory cf = ssl_connector.getSslContextFactory();
+ SslContextFactory cf = ssl_connector.getConnectionFactory().getSslContextFactory();
cf.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");

Back to the top