Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2012-08-03 12:35:34 -0400
committerSimone Bordet2012-08-03 12:35:34 -0400
commite3132d41d8260915ca79c622f6b720a62dbbc635 (patch)
treee233aef842e74eee0d38cce187a7cf4e64715e90 /jetty-websocket
parent2d7b6c9c06f7e7ee73a2cb9ec8ae3b0e94adac2c (diff)
downloadorg.eclipse.jetty.project-e3132d41d8260915ca79c622f6b720a62dbbc635.tar.gz
org.eclipse.jetty.project-e3132d41d8260915ca79c622f6b720a62dbbc635.tar.xz
org.eclipse.jetty.project-e3132d41d8260915ca79c622f6b720a62dbbc635.zip
Jetty9 - Introduced ConnectionFactory for SelectChannelConnector.
This change abstracts out the connection creation from the connector itself, so there can be only one connector managing all protocols, depending on the configuration of the connection factories.
Diffstat (limited to 'jetty-websocket')
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java6
-rw-r--r--jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketOverSSLTest.java11
2 files changed, 7 insertions, 10 deletions
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
index 9f29e1dad1..01b1a51621 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
@@ -21,18 +21,16 @@ import java.nio.channels.SocketChannel;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
+import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
-import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.ssl.SslConnection;
import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.websocket.api.WebSocketConnection;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.WebSocketClientFactory;
@@ -146,7 +144,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
{
String peerHost = channel.socket().getInetAddress().getHostAddress();
int peerPort = channel.socket().getPort();
- SSLEngine engine = sslContextFactory.newSslEngine(peerHost,peerPort);
+ SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
engine.setUseClientMode(true);
return engine;
}
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 971ff14b7b..5c8ffc2d88 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
@@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
@@ -95,13 +94,13 @@ public class WebSocketOverSSLTest
private void startServer(final Object websocket) throws Exception
{
+ SslContextFactory sslContextFactory = new SslContextFactory();
+ sslContextFactory.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath());
+ sslContextFactory.setKeyStorePassword("storepwd");
+ sslContextFactory.setKeyManagerPassword("keypwd");
_server = new Server();
- SelectChannelConnector connector = new SelectChannelConnector(_server,true);
+ SelectChannelConnector connector = new SelectChannelConnector(_server, sslContextFactory);
_server.addConnector(connector);
- SslContextFactory cf = connector.getConnectionFactory().getSslContextFactory();
- cf.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath());
- cf.setKeyStorePassword("storepwd");
- cf.setKeyManagerPassword("keypwd");
_server.setHandler(new WebSocketHandler.Simple(websocket.getClass()));
_server.start();
_port = connector.getLocalPort();

Back to the top