summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2019-04-17 13:14:34 +0200
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2019-04-18 08:13:48 +0000
commitacff2f2611e271b83c9190b060d42c88bb292fa5 (patch)
treedef222fc92d3577fe82ee7974f574b16ca25b83b
parentaf08406cd3eff4105d59acc073af3bc9f539084b (diff)
Fix server test code
For MQTT 5 the fake server did not send any property information. Hence, the client (potentially) read among the buffer. Change-Id: I58c7d1b4a1f15a0803c04495c82537f648c8a642 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--tests/auto/qmqttclient/tst_qmqttclient.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/qmqttclient/tst_qmqttclient.cpp b/tests/auto/qmqttclient/tst_qmqttclient.cpp
index 8aec3d5..c4da40d 100644
--- a/tests/auto/qmqttclient/tst_qmqttclient.cpp
+++ b/tests/auto/qmqttclient/tst_qmqttclient.cpp
@@ -486,6 +486,8 @@ public slots:
} else {
response += char(0); // ackFlags
response += char(0); // result
+ if (version == QMqttClient::MQTT_5_0)
+ response += char(0); // No properties
}
qDebug() << "Fake server response:" << connectionSuccess;
socket->write(response);
@@ -493,6 +495,7 @@ public slots:
public:
QTcpServer *server;
QTcpSocket *socket;
+ QMqttClient::ProtocolVersion version{QMqttClient::MQTT_3_1_1};
bool connectionSuccess{false};
};
@@ -509,6 +512,8 @@ void Tst_QMqttClient::reconnect_QTBUG65726()
client.setHostname(QLatin1String("localhost"));
client.setPort(5726);
+ server.version = client.protocolVersion();
+
client.connectToHost();
QTRY_COMPARE(client.state(), QMqttClient::Disconnected);
QTRY_COMPARE(client.error(), QMqttClient::ProtocolViolation);