Added ISslContextCreator method argument to Server.startServer to use embedded SSL certificates (fix issue #115)

This commit is contained in:
andsel
2015-12-13 16:36:47 +01:00
parent b280089225
commit 51627ea2f6
6 changed files with 163 additions and 99 deletions
@@ -100,9 +100,14 @@ public class Server {
}
/**
* Starts Moquette with config provided by an implementation of IConfig class and with the set of InterceptHandler
* Starts Moquette with config provided by an implementation of IConfig class and with the
* set of InterceptHandler.
* */
public void startServer(IConfig config, List<? extends InterceptHandler> handlers) throws IOException {
startServer(config, handlers, null);
}
public void startServer(IConfig config, List<? extends InterceptHandler> handlers, ISslContextCreator sslCtxCreator) throws IOException {
if (handlers == null) {
handlers = Collections.emptyList();
}
@@ -114,8 +119,12 @@ public class Server {
LOG.info("Persistent store file: " + config.getProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME));
final ProtocolProcessor processor = SimpleMessaging.getInstance().init(config, handlers);
if (sslCtxCreator == null) {
sslCtxCreator = new DefaultMoquetteSslContextCreator(config);
}
m_acceptor = new NettyAcceptor();
m_acceptor.initialize(processor, config);
m_acceptor.initialize(processor, config, sslCtxCreator);
m_processor = processor;
m_initialized = true;
}