Allow config of enabled protocols for nio+ssl and stomp+nio+ssl etc to
match the capability of the non-nio transports.
This commit is contained in:
Timothy Bish 2014-10-23 15:03:35 -04:00
parent 33089f3fbb
commit 1948fe41a3
2 changed files with 20 additions and 0 deletions

View File

@ -50,6 +50,7 @@ public class NIOSSLTransport extends NIOTransport {
protected boolean needClientAuth;
protected boolean wantClientAuth;
protected String[] enabledCipherSuites;
protected String[] enabledProtocols;
protected SSLContext sslContext;
protected SSLEngine sslEngine;
@ -106,6 +107,10 @@ public class NIOSSLTransport extends NIOTransport {
sslEngine.setEnabledCipherSuites(enabledCipherSuites);
}
if (enabledProtocols != null) {
sslEngine.setEnabledProtocols(enabledProtocols);
}
if (wantClientAuth) {
sslEngine.setWantClientAuth(wantClientAuth);
}
@ -435,4 +440,12 @@ public class NIOSSLTransport extends NIOTransport {
public void setEnabledCipherSuites(String[] enabledCipherSuites) {
this.enabledCipherSuites = enabledCipherSuites;
}
public String[] getEnabledProtocols() {
return enabledProtocols;
}
public void setEnabledProtocols(String[] enabledProtocols) {
this.enabledProtocols = enabledProtocols;
}
}

View File

@ -90,6 +90,13 @@ public class NIOSSLBasicTest {
stopBroker(broker);
}
@Test
public void enabledProtocols() throws Exception {
BrokerService broker = createBroker("nio+ssl", "nio+ssl://localhost:61616?transport.needClientAuth=true&transport.enabledProtocols=TLSv1,TLSv1.1,TLSv1.2");
basicSendReceive("ssl://localhost:" + broker.getConnectorByName("nio+ssl").getConnectUri().getPort());
stopBroker(broker);
}
public void basicSendReceive(String uri) throws Exception {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uri);
Connection connection = factory.createConnection();