diff --git a/FlashMQTests/twoclienttestcontext.cpp b/FlashMQTests/twoclienttestcontext.cpp index f780bcf..512bd98 100644 --- a/FlashMQTests/twoclienttestcontext.cpp +++ b/FlashMQTests/twoclienttestcontext.cpp @@ -26,9 +26,9 @@ TwoClientTestContext::TwoClientTestContext(int clientNr, QObject *parent) : QObj { QHostInfo targetHostInfo = QHostInfo::fromName("localhost"); QHostAddress targetHost(targetHostInfo.addresses().first()); - sender.reset(new QMQTT::Client(targetHost)); + sender.reset(new QMQTT::Client(targetHost, 21883)); sender->setClientId(QString("Sender%1").arg(clientNr)); - receiver.reset(new QMQTT::Client(targetHost)); + receiver.reset(new QMQTT::Client(targetHost, 21883)); receiver->setClientId(QString("Receiver%1").arg(clientNr)); connect(sender.data(), &QMQTT::Client::error, this, &TwoClientTestContext::onClientError); diff --git a/flashmqtestclient.cpp b/flashmqtestclient.cpp index 9045182..1951263 100644 --- a/flashmqtestclient.cpp +++ b/flashmqtestclient.cpp @@ -95,7 +95,7 @@ void FlashMQTestClient::connectClient(ProtocolVersion protocolVersion, bool clea servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = inet_addr(hostname.c_str()); - servaddr.sin_port = htons(1883); + servaddr.sin_port = htons(21883); int flags = fcntl(sockfd, F_GETFL); fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); diff --git a/mainapp.cpp b/mainapp.cpp index 80eb56f..d80d5d3 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -728,6 +728,12 @@ void MainApp::loadConfig() if (settings->listeners.empty()) { std::shared_ptr defaultListener = std::make_shared(); + + // Kind of a quick hack to do this this way. +#ifdef TESTING + defaultListener->port = 21883; +#endif + defaultListener->isValid(); settings->listeners.push_back(defaultListener); }