enable the usage of Netty OpenSSL provider implementation
Signed-off-by: Maik Scheibler <[email protected]>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* 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 io.moquette.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import io.moquette.BrokerConstants;
|
||||
import io.netty.handler.ssl.OpenSsl;
|
||||
import io.netty.handler.ssl.SslProvider;
|
||||
import org.junit.BeforeClass;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Check that Moquette could also handle SSL with OpenSSL provider.
|
||||
*/
|
||||
public class ServerIntegrationOpenSSLTest extends ServerIntegrationSSLTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServerIntegrationOpenSSLTest.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeTests() {
|
||||
LOG.info("try to initialize OpenSSL native library");
|
||||
OpenSsl.ensureAvailability();
|
||||
LOG.info("OpenSSL initialized");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startServer() throws IOException {
|
||||
String file = getClass().getResource("/").getPath();
|
||||
System.setProperty("moquette.path", file);
|
||||
m_server = new Server();
|
||||
Properties sslProps = new Properties();
|
||||
|
||||
sslProps.put(BrokerConstants.SSL_PROVIDER, SslProvider.OPENSSL.name());
|
||||
sslProps.put(BrokerConstants.NEED_CLIENT_AUTH, "true");
|
||||
|
||||
sslProps.put(BrokerConstants.SSL_PORT_PROPERTY_NAME, "8883");
|
||||
sslProps.put(BrokerConstants.JKS_PATH_PROPERTY_NAME, "serverkeystore.jks");
|
||||
sslProps.put(BrokerConstants.KEY_STORE_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
|
||||
sslProps.put(BrokerConstants.KEY_MANAGER_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
|
||||
sslProps.put(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, IntegrationUtils.localMapDBPath());
|
||||
m_server.startServer(sslProps);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,8 @@ public class ServerLowlevelMessagesIntegrationTests {
|
||||
MqttConnectVariableHeader mqttConnectVariableHeader = new MqttConnectVariableHeader(
|
||||
MqttVersion.MQTT_3_1.protocolName(), MqttVersion.MQTT_3_1.protocolLevel(), false, false, false, 1, false,
|
||||
true, keepAlive);
|
||||
MqttConnectPayload mqttConnectPayload = new MqttConnectPayload(clientID, (String)null, (byte[])null, (String)null, (byte[])null);
|
||||
MqttConnectPayload mqttConnectPayload = new MqttConnectPayload(clientID, (String) null, (byte[]) null,
|
||||
(String) null, (byte[]) null);
|
||||
return new MqttConnectMessage(mqttFixedHeader, mqttConnectVariableHeader, mqttConnectPayload);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user