Class TestMoquetteServer
java.lang.Object
test.de.iip_ecosphere.platform.transport.AbstractTestServer
test.de.iip_ecosphere.platform.test.mqtt.moquette.TestMoquetteServer
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.Server
- Direct Known Subclasses:
TestMoquetteTlsServer
public class TestMoquetteServer
extends test.de.iip_ecosphere.platform.transport.AbstractTestServer
A simple embedded Moquette-based MQTT test server for testing/experiments. This class works with Java 8.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTestMoquetteServer(de.iip_ecosphere.platform.support.ServerAddress addr) Creates the server instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears authentication entries.static voidStarts the server from the command line.static voidsetBasicAuth(String user, String password) Sets up a simple user and password authentication.de.iip_ecosphere.platform.support.Serverstart()voidstop(boolean dispose) Methods inherited from class test.de.iip_ecosphere.platform.transport.AbstractTestServer
applyBaseDir, extractConfiguration, extractConfiguration, getConfigDir, getConfigDir, getInteger, getInteger, getString, runsFromJar, setConfigDir
-
Field Details
-
KEYSTORE_PASSWORD
- See Also:
-
KEY_ALIAS
- See Also:
-
mqttBroker
private io.moquette.broker.Server mqttBroker -
addr
private de.iip_ecosphere.platform.support.ServerAddress addr
-
-
Constructor Details
-
TestMoquetteServer
public TestMoquetteServer(de.iip_ecosphere.platform.support.ServerAddress addr) Creates the server instance.- Parameters:
addr- the server address (schema is ignored)
-
-
Method Details
-
setBasicAuth
Sets up a simple user and password authentication.- Parameters:
user- the user to addpassword- the plaintext password of the user
-
clearAuth
public static void clearAuth()Clears authentication entries. -
start
public de.iip_ecosphere.platform.support.Server start() -
stop
public void stop(boolean dispose) -
main
Starts the server from the command line.- Parameters:
args- the first argument may be the port number, else 8883 is used
-