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
    Modifier and Type
    Field
    Description
    private de.iip_ecosphere.platform.support.ServerAddress
     
    static final String
     
    static final String
     
    private io.moquette.broker.Server
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestMoquetteServer(de.iip_ecosphere.platform.support.ServerAddress addr)
    Creates the server instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Clears authentication entries.
    static void
    main(String[] args)
    Starts the server from the command line.
    static void
    setBasicAuth(String user, String password)
    Sets up a simple user and password authentication.
    de.iip_ecosphere.platform.support.Server
     
    void
    stop(boolean dispose)
     

    Methods inherited from class test.de.iip_ecosphere.platform.transport.AbstractTestServer

    applyBaseDir, extractConfiguration, extractConfiguration, getConfigDir, getConfigDir, getInteger, getInteger, getString, runsFromJar, setConfigDir

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • KEYSTORE_PASSWORD

      public static final String KEYSTORE_PASSWORD
      See Also:
    • KEY_ALIAS

      public static final String 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

      public static void setBasicAuth(String user, String password)
      Sets up a simple user and password authentication.
      Parameters:
      user - the user to add
      password - 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

      public static void main(String[] args)
      Starts the server from the command line.
      Parameters:
      args - the first argument may be the port number, else 8883 is used