diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java b/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java index b99f549d96..eb47bbb0d4 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java @@ -42,7 +42,7 @@ public class SecureSocketConnectorFactory extends SocketConnectorFactory { private String auth; private SslContext context; - private SslContextFactory contextFactory; + private SslContextFactory.Server contextFactory; public SecureSocketConnectorFactory() { @@ -51,7 +51,7 @@ public class SecureSocketConnectorFactory extends SocketConnectorFactory { this.context = context; } - public SecureSocketConnectorFactory(SslContextFactory contextFactory) { + public SecureSocketConnectorFactory(SslContextFactory.Server contextFactory) { this.contextFactory = contextFactory; } @@ -65,7 +65,7 @@ public class SecureSocketConnectorFactory extends SocketConnectorFactory { // Get a reference to the current ssl context factory... - SslContextFactory factory; + SslContextFactory.Server factory; if (contextFactory == null) { factory = new SslContextFactory.Server(); if (context != null) { diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSSubProtocolTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSSubProtocolTest.java index 8030ed851c..9a493c0aab 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSSubProtocolTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSSubProtocolTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.concurrent.TimeUnit; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -39,7 +40,7 @@ public class MQTTWSSubProtocolTest extends WSTransportTestSupport { public void setUp() throws Exception { super.setUp(); - wsClient = new WebSocketClient(new SslContextFactory.Client(true)); + wsClient = new WebSocketClient(new HttpClient(new SslContextFactory.Client(true))); wsClient.start(); } diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportTest.java index ddaac6bfa0..9069c52369 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.util.Wait; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -68,7 +69,7 @@ public class MQTTWSTransportTest extends WSTransportTestSupport { public void setUp() throws Exception { super.setUp(); - wsClient = new WebSocketClient(new SslContextFactory.Client(true)); + wsClient = new WebSocketClient(new HttpClient(new SslContextFactory.Client(true))); wsClient.start(); request = new ClientUpgradeRequest(); diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportWillTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportWillTest.java index b78f15267d..7b9d08b152 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportWillTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/MQTTWSTransportWillTest.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.concurrent.TimeUnit; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -78,7 +79,7 @@ public class MQTTWSTransportWillTest extends WSTransportTestSupport { //turn off advisory support broker = createBroker(true, false); - wsClient = new WebSocketClient(new SslContextFactory.Client(true)); + wsClient = new WebSocketClient(new HttpClient(new SslContextFactory.Client(true))); wsClient.start(); request = new ClientUpgradeRequest(); diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSSubProtocolTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSSubProtocolTest.java index 1858224570..bc4678a736 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSSubProtocolTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSSubProtocolTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.activemq.transport.stomp.Stomp; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -150,7 +151,7 @@ public class StompWSSubProtocolTest extends WSTransportTestSupport { request.setSubProtocols(subProtocol); } - wsClient = new WebSocketClient(new SslContextFactory.Client(true)); + wsClient = new WebSocketClient(new HttpClient(new SslContextFactory.Client(true))); wsClient.start(); wsClient.connect(wsStompConnection, wsConnectUri, request); diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSTransportTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSTransportTest.java index c1b506916f..d9ea8ec417 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSTransportTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/ws/StompWSTransportTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.transport.stomp.Stomp; import org.apache.activemq.transport.stomp.StompFrame; import org.apache.activemq.util.Wait; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -57,7 +58,7 @@ public class StompWSTransportTest extends WSTransportTestSupport { ClientUpgradeRequest request = new ClientUpgradeRequest(); request.setSubProtocols("v11.stomp"); - wsClient = new WebSocketClient(new SslContextFactory.Client(true)); + wsClient = new WebSocketClient(new HttpClient(new SslContextFactory.Client(true))); wsClient.start(); wsClient.connect(wsStompConnection, wsConnectUri, request); diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/wss/WSSTransportNeedClientAuthTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/wss/WSSTransportNeedClientAuthTest.java index 2fdef4011c..3a81f5b146 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/wss/WSSTransportNeedClientAuthTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/wss/WSSTransportNeedClientAuthTest.java @@ -22,6 +22,7 @@ import org.apache.activemq.transport.stomp.Stomp; import org.apache.activemq.transport.stomp.StompFrame; import org.apache.activemq.transport.ws.MQTTWSConnection; import org.apache.activemq.transport.ws.StompWSConnection; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; @@ -84,28 +85,29 @@ public class WSSTransportNeedClientAuthTest { factory.setTrustStorePath(TRUST_KEYSTORE); factory.setTrustStorePassword(PASSWORD); factory.setTrustStoreType(KEYSTORE_TYPE); - WebSocketClient wsClient = new WebSocketClient(factory); + WebSocketClient wsClient = new WebSocketClient(new HttpClient(factory)); wsClient.start(); Future connected = wsClient.connect(wsStompConnection, new URI("wss://localhost:61618")); - Session sess = connected.get(30, TimeUnit.SECONDS); + + try(Session sess = connected.get(30, TimeUnit.SECONDS)) { - String connectFrame = "STOMP\n" + - "login:system\n" + - "passcode:manager\n" + - "accept-version:1.2\n" + - "host:localhost\n" + - "\n" + Stomp.NULL; + String connectFrame = "STOMP\n" + + "login:system\n" + + "passcode:manager\n" + + "accept-version:1.2\n" + + "host:localhost\n" + + "\n" + Stomp.NULL; - wsStompConnection.sendRawFrame(connectFrame); + wsStompConnection.sendRawFrame(connectFrame); - String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS); - assertNotNull(incoming); - assertTrue(incoming.startsWith("CONNECTED")); - - wsStompConnection.sendFrame(new StompFrame(Stomp.Commands.DISCONNECT)); - wsStompConnection.close(); + String incoming = wsStompConnection.receive(30, TimeUnit.SECONDS); + assertNotNull(incoming); + assertTrue(incoming.startsWith("CONNECTED")); + wsStompConnection.sendFrame(new StompFrame(Stomp.Commands.DISCONNECT)); + wsStompConnection.close(); + } } @Test @@ -117,7 +119,7 @@ public class WSSTransportNeedClientAuthTest { factory.setTrustStorePath(TRUST_KEYSTORE); factory.setTrustStorePassword(PASSWORD); factory.setTrustStoreType(KEYSTORE_TYPE); - WebSocketClient wsClient = new WebSocketClient(factory); + WebSocketClient wsClient = new WebSocketClient(new HttpClient(factory)); wsClient.start(); ClientUpgradeRequest request = new ClientUpgradeRequest();