コード例 #1
0
  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(io.moquette.commons.Constants.SSL_PORT_PROPERTY_NAME, "8883");
    sslProps.put(Constants.JKS_PATH_PROPERTY_NAME, "serverkeystore.jks");
    sslProps.put(Constants.KEY_STORE_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
    sslProps.put(Constants.KEY_MANAGER_PASSWORD_PROPERTY_NAME, "passw0rdsrv");
    sslProps.put(Constants.PERSISTENT_STORE_PROPERTY_NAME, IntegrationUtils.localMapDBPath());
    m_server.startServer(sslProps);
  }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    String dbPath = IntegrationUtils.localMapDBPath();
    File dbFile = new File(dbPath);
    assertFalse(String.format("The DB storagefile %s already exists", dbPath), dbFile.exists());

    startServer();

    m_client = new MqttClient("ssl://localhost:8883", "TestClient", s_dataStore);
    //        m_client = new MqttClient("ssl://test.mosquitto.org:8883", "TestClient", s_dataStore);

    m_callback = new TestCallback();
    m_client.setCallback(m_callback);
  }
コード例 #3
0
  @After
  public void tearDown() throws Exception {
    if (m_client != null && m_client.isConnected()) {
      m_client.disconnect();
    }

    if (m_server != null) {
      m_server.stopServer();
    }
    String dbPath = IntegrationUtils.localMapDBPath();
    File dbFile = new File(dbPath);
    if (dbFile.exists()) {
      dbFile.delete();
    }
    assertFalse(dbFile.exists());
  }