Make TCP default connection for clients
This commit is contained in:
parent
816111ddc7
commit
1c57db04f3
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -115,11 +115,9 @@ void ProxyClient::resetTimer()
|
|||||||
{
|
{
|
||||||
switch (m_timerWaitState) {
|
switch (m_timerWaitState) {
|
||||||
case TimerWaitStateInactive:
|
case TimerWaitStateInactive:
|
||||||
m_timer->stop();
|
|
||||||
m_timer->start(Engine::instance()->configuration()->inactiveTimeout());
|
m_timer->start(Engine::instance()->configuration()->inactiveTimeout());
|
||||||
break;
|
break;
|
||||||
case TimerWaitStateAlone:
|
case TimerWaitStateAlone:
|
||||||
m_timer->stop();
|
|
||||||
m_timer->start(Engine::instance()->configuration()->aloneTimeout());
|
m_timer->start(Engine::instance()->configuration()->aloneTimeout());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -137,7 +135,7 @@ QList<QByteArray> ProxyClient::processData(const QByteArray &data)
|
|||||||
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
||||||
splitIndex = m_dataBuffer.indexOf("}\n{");
|
splitIndex = m_dataBuffer.indexOf("}\n{");
|
||||||
}
|
}
|
||||||
if (m_dataBuffer.trimmed().endsWith("}")) {
|
if (m_dataBuffer.endsWith("}\n") || m_dataBuffer.endsWith("}")) {
|
||||||
packets.append(m_dataBuffer);
|
packets.append(m_dataBuffer);
|
||||||
m_dataBuffer.clear();
|
m_dataBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -381,10 +381,10 @@ void ProxyServer::onProxyClientTimeoutOccurred()
|
|||||||
qCDebug(dcProxyServer()) << "Timeout occurred for" << proxyClient;
|
qCDebug(dcProxyServer()) << "Timeout occurred for" << proxyClient;
|
||||||
switch (proxyClient->timerWaitState()) {
|
switch (proxyClient->timerWaitState()) {
|
||||||
case ProxyClient::TimerWaitStateInactive:
|
case ProxyClient::TimerWaitStateInactive:
|
||||||
proxyClient->killConnection("Proxy timeout occuret. The socket was inactive.");
|
proxyClient->killConnection("Proxy timeout occurred. The socket was inactive.");
|
||||||
break;
|
break;
|
||||||
case ProxyClient::TimerWaitStateAlone:
|
case ProxyClient::TimerWaitStateAlone:
|
||||||
proxyClient->killConnection("Proxy timeout occuret. The tunnel partner did not show up.");
|
proxyClient->killConnection("Proxy timeout occurred. The tunnel partner did not show up.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ private:
|
|||||||
bool m_sslEnabled;
|
bool m_sslEnabled;
|
||||||
QSslConfiguration m_sslConfiguration;
|
QSslConfiguration m_sslConfiguration;
|
||||||
|
|
||||||
QHash<QUuid, QTcpSocket *> m_clientList;
|
QHash<QUuid, QTcpSocket *> m_clientList;
|
||||||
|
|
||||||
SslServer *m_server = nullptr;
|
SslServer *m_server = nullptr;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void WebSocketServer::onClientConnected()
|
|||||||
// Got a new client connected
|
// Got a new client connected
|
||||||
QWebSocket *client = m_server->nextPendingConnection();
|
QWebSocket *client = m_server->nextPendingConnection();
|
||||||
if (!client) {
|
if (!client) {
|
||||||
qCWarning(dcWebSocketServer()) << "Next pending connection dissapeared. Doing nothing.";
|
qCWarning(dcWebSocketServer()) << "Next pending connection disappeared. Doing nothing.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ void WebSocketServer::onClientError(QAbstractSocket::SocketError error)
|
|||||||
QWebSocket *client = static_cast<QWebSocket *>(sender());
|
QWebSocket *client = static_cast<QWebSocket *>(sender());
|
||||||
qCWarning(dcWebSocketServer()) << "Client error occurred:" << client << client->peerAddress().toString() << error << client->errorString() << "Closing the socket.";
|
qCWarning(dcWebSocketServer()) << "Client error occurred:" << client << client->peerAddress().toString() << error << client->errorString() << "Closing the socket.";
|
||||||
|
|
||||||
// Note: on any error which can occure, make sure the socket will be closed in any case
|
// Note: on any error which can occurre, make sure the socket will be closed in any case
|
||||||
client->close();
|
client->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ bool WebSocketServer::stopServer()
|
|||||||
if (!m_server)
|
if (!m_server)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
qCDebug(dcWebSocketServer()) << "Stop server" << m_server->serverName() << serverUrl().toString();
|
qCDebug(dcWebSocketServer()) << "Stopping server" << m_server->serverName() << serverUrl().toString();
|
||||||
m_server->close();
|
m_server->close();
|
||||||
delete m_server;
|
delete m_server;
|
||||||
m_server = nullptr;
|
m_server = nullptr;
|
||||||
|
|||||||
@ -60,7 +60,7 @@ QList<QByteArray> TunnelProxyClient::processData(const QByteArray &data)
|
|||||||
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
||||||
splitIndex = m_dataBuffer.indexOf("}\n{");
|
splitIndex = m_dataBuffer.indexOf("}\n{");
|
||||||
}
|
}
|
||||||
if (m_dataBuffer.trimmed().endsWith("}")) {
|
if (m_dataBuffer.endsWith("}\n") || m_dataBuffer.endsWith("}")) {
|
||||||
packets.append(m_dataBuffer);
|
packets.append(m_dataBuffer);
|
||||||
m_dataBuffer.clear();
|
m_dataBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -200,7 +200,7 @@ void JsonRpcClient::processData(const QByteArray &data)
|
|||||||
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
m_dataBuffer = m_dataBuffer.right(m_dataBuffer.length() - splitIndex - 2);
|
||||||
splitIndex = m_dataBuffer.indexOf("}\n{");
|
splitIndex = m_dataBuffer.indexOf("}\n{");
|
||||||
}
|
}
|
||||||
if (m_dataBuffer.trimmed().endsWith("}")) {
|
if (m_dataBuffer.endsWith("}\n") || m_dataBuffer.endsWith("}")) {
|
||||||
processDataPacket(m_dataBuffer);
|
processDataPacket(m_dataBuffer);
|
||||||
m_dataBuffer.clear();
|
m_dataBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -129,14 +129,14 @@ void RemoteProxyTestsProxy::monitorServer()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionOne->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionOne->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionOneReadySpy.wait();
|
connectionOneReadySpy.wait();
|
||||||
QVERIFY(connectionOneReadySpy.count() == 1);
|
QVERIFY(connectionOneReadySpy.count() == 1);
|
||||||
QVERIFY(connectionOne->isConnected());
|
QVERIFY(connectionOne->isConnected());
|
||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionTwoReadySpy.wait();
|
connectionTwoReadySpy.wait();
|
||||||
QVERIFY(connectionTwoReadySpy.count() == 1);
|
QVERIFY(connectionTwoReadySpy.count() == 1);
|
||||||
QVERIFY(connectionTwo->isConnected());
|
QVERIFY(connectionTwo->isConnected());
|
||||||
@ -598,14 +598,14 @@ void RemoteProxyTestsProxy::authenticateNonce()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionOne->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionOne->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionOneReadySpy.wait();
|
connectionOneReadySpy.wait();
|
||||||
QVERIFY(connectionOneReadySpy.count() == 1);
|
QVERIFY(connectionOneReadySpy.count() == 1);
|
||||||
QVERIFY(connectionOne->isConnected());
|
QVERIFY(connectionOne->isConnected());
|
||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionTwoReadySpy.wait();
|
connectionTwoReadySpy.wait();
|
||||||
QVERIFY(connectionTwoReadySpy.count() == 1);
|
QVERIFY(connectionTwoReadySpy.count() == 1);
|
||||||
QVERIFY(connectionTwo->isConnected());
|
QVERIFY(connectionTwo->isConnected());
|
||||||
@ -720,7 +720,7 @@ void RemoteProxyTestsProxy::clientConnectionWebSocket()
|
|||||||
m_mockAuthenticator->setExpectedAuthenticationError();
|
m_mockAuthenticator->setExpectedAuthenticationError();
|
||||||
|
|
||||||
// Connect to the server using WebSocket (insecure disabled)
|
// Connect to the server using WebSocket (insecure disabled)
|
||||||
RemoteProxyConnection *connection = new RemoteProxyConnection(QUuid::createUuid(), "Test client one", this);
|
RemoteProxyConnection *connection = new RemoteProxyConnection(QUuid::createUuid(), "Test client one", RemoteProxyConnection::ConnectionTypeWebSocket, this);
|
||||||
connect(connection, &RemoteProxyConnection::sslErrors, this, &BaseTest::ignoreConnectionSslError);
|
connect(connection, &RemoteProxyConnection::sslErrors, this, &BaseTest::ignoreConnectionSslError);
|
||||||
|
|
||||||
// Connect to server (insecue enabled for testing)
|
// Connect to server (insecue enabled for testing)
|
||||||
@ -837,14 +837,14 @@ void RemoteProxyTestsProxy::remoteConnection()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionOne->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionOne->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionOneReadySpy.wait();
|
connectionOneReadySpy.wait();
|
||||||
QVERIFY(connectionOneReadySpy.count() == 1);
|
QVERIFY(connectionOneReadySpy.count() == 1);
|
||||||
QVERIFY(connectionOne->isConnected());
|
QVERIFY(connectionOne->isConnected());
|
||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionTwoReadySpy.wait();
|
connectionTwoReadySpy.wait();
|
||||||
QVERIFY(connectionTwoReadySpy.count() == 1);
|
QVERIFY(connectionTwoReadySpy.count() == 1);
|
||||||
QVERIFY(connectionTwo->isConnected());
|
QVERIFY(connectionTwo->isConnected());
|
||||||
@ -956,14 +956,14 @@ void RemoteProxyTestsProxy::trippleConnection()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionOne->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionOne->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionOneReadySpy.wait();
|
connectionOneReadySpy.wait();
|
||||||
QVERIFY(connectionOneReadySpy.count() == 1);
|
QVERIFY(connectionOneReadySpy.count() == 1);
|
||||||
QVERIFY(connectionOne->isConnected());
|
QVERIFY(connectionOne->isConnected());
|
||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionTwoReadySpy.wait();
|
connectionTwoReadySpy.wait();
|
||||||
QVERIFY(connectionTwoReadySpy.count() == 1);
|
QVERIFY(connectionTwoReadySpy.count() == 1);
|
||||||
QVERIFY(connectionTwo->isConnected());
|
QVERIFY(connectionTwo->isConnected());
|
||||||
@ -996,7 +996,7 @@ void RemoteProxyTestsProxy::trippleConnection()
|
|||||||
// Connect three
|
// Connect three
|
||||||
QSignalSpy connectionThreeReadySpy(connectionThree, &RemoteProxyConnection::ready);
|
QSignalSpy connectionThreeReadySpy(connectionThree, &RemoteProxyConnection::ready);
|
||||||
QSignalSpy connectionThreeDisconnectedSpy(connectionThree, &RemoteProxyConnection::disconnected);
|
QSignalSpy connectionThreeDisconnectedSpy(connectionThree, &RemoteProxyConnection::disconnected);
|
||||||
QVERIFY(connectionThree->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionThree->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionThreeReadySpy.wait();
|
connectionThreeReadySpy.wait();
|
||||||
QVERIFY(connectionThreeReadySpy.count() == 1);
|
QVERIFY(connectionThreeReadySpy.count() == 1);
|
||||||
QVERIFY(connectionThree->isConnected());
|
QVERIFY(connectionThree->isConnected());
|
||||||
@ -1041,14 +1041,14 @@ void RemoteProxyTestsProxy::duplicateUuid()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionOne->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionOne->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionOneReadySpy.wait();
|
connectionOneReadySpy.wait();
|
||||||
QVERIFY(connectionOneReadySpy.count() == 1);
|
QVERIFY(connectionOneReadySpy.count() == 1);
|
||||||
QVERIFY(connectionOne->isConnected());
|
QVERIFY(connectionOne->isConnected());
|
||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connectionTwo->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionTwoReadySpy.wait();
|
connectionTwoReadySpy.wait();
|
||||||
QVERIFY(connectionTwoReadySpy.count() == 1);
|
QVERIFY(connectionTwoReadySpy.count() == 1);
|
||||||
QVERIFY(connectionTwo->isConnected());
|
QVERIFY(connectionTwo->isConnected());
|
||||||
@ -1088,7 +1088,7 @@ void RemoteProxyTestsProxy::sslConfigurations()
|
|||||||
// Connect to the server (insecure disabled)
|
// Connect to the server (insecure disabled)
|
||||||
RemoteProxyConnection *connector = new RemoteProxyConnection(QUuid::createUuid(), "Test client one", this);
|
RemoteProxyConnection *connector = new RemoteProxyConnection(QUuid::createUuid(), "Test client one", this);
|
||||||
QSignalSpy spyError(connector, &RemoteProxyConnection::errorOccurred);
|
QSignalSpy spyError(connector, &RemoteProxyConnection::errorOccurred);
|
||||||
QVERIFY(connector->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connector->connectServer(m_serverUrlProxyTcp));
|
||||||
spyError.wait();
|
spyError.wait();
|
||||||
QVERIFY(spyError.count() == 1);
|
QVERIFY(spyError.count() == 1);
|
||||||
qDebug() << connector->error();
|
qDebug() << connector->error();
|
||||||
@ -1098,7 +1098,7 @@ void RemoteProxyTestsProxy::sslConfigurations()
|
|||||||
// Connect to server (insecue enabled)
|
// Connect to server (insecue enabled)
|
||||||
QSignalSpy spyConnected(connector, &RemoteProxyConnection::connected);
|
QSignalSpy spyConnected(connector, &RemoteProxyConnection::connected);
|
||||||
connect(connector, &RemoteProxyConnection::sslErrors, this, &BaseTest::ignoreConnectionSslError);
|
connect(connector, &RemoteProxyConnection::sslErrors, this, &BaseTest::ignoreConnectionSslError);
|
||||||
connector->connectServer(m_serverUrlProxyWebSocket);
|
connector->connectServer(m_serverUrlProxyTcp);
|
||||||
spyConnected.wait();
|
spyConnected.wait();
|
||||||
|
|
||||||
QVERIFY(connector->isConnected());
|
QVERIFY(connector->isConnected());
|
||||||
@ -1153,7 +1153,7 @@ void RemoteProxyTestsProxy::inactiveTimeout()
|
|||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionReadySpy(connection, &RemoteProxyConnection::ready);
|
QSignalSpy connectionReadySpy(connection, &RemoteProxyConnection::ready);
|
||||||
QSignalSpy connectionDisconnectedSpy(connection, &RemoteProxyConnection::disconnected);
|
QSignalSpy connectionDisconnectedSpy(connection, &RemoteProxyConnection::disconnected);
|
||||||
QVERIFY(connection->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connection->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionReadySpy.wait();
|
connectionReadySpy.wait();
|
||||||
QVERIFY(connectionReadySpy.count() == 1);
|
QVERIFY(connectionReadySpy.count() == 1);
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ void RemoteProxyTestsProxy::authenticationReplyConnection()
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionReadySpy(connection, &RemoteProxyConnection::ready);
|
QSignalSpy connectionReadySpy(connection, &RemoteProxyConnection::ready);
|
||||||
QVERIFY(connection->connectServer(m_serverUrlProxyWebSocket));
|
QVERIFY(connection->connectServer(m_serverUrlProxyTcp));
|
||||||
connectionReadySpy.wait();
|
connectionReadySpy.wait();
|
||||||
QVERIFY(connectionReadySpy.count() == 1);
|
QVERIFY(connectionReadySpy.count() == 1);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
* Copyright 2013 - 2022, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|||||||
@ -326,7 +326,7 @@ bool BaseTest::createRemoteConnection(const QString &token, const QString &nonce
|
|||||||
|
|
||||||
// Connect one
|
// Connect one
|
||||||
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
QSignalSpy connectionOneReadySpy(connectionOne, &RemoteProxyConnection::ready);
|
||||||
if (!connectionOne->connectServer(m_serverUrlProxyWebSocket)) {
|
if (!connectionOne->connectServer(m_serverUrlProxyTcp)) {
|
||||||
qWarning() << "Could not connect client one";
|
qWarning() << "Could not connect client one";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ bool BaseTest::createRemoteConnection(const QString &token, const QString &nonce
|
|||||||
|
|
||||||
// Connect two
|
// Connect two
|
||||||
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
QSignalSpy connectionTwoReadySpy(connectionTwo, &RemoteProxyConnection::ready);
|
||||||
if (!connectionTwo->connectServer(m_serverUrlProxyWebSocket)) {
|
if (!connectionTwo->connectServer(m_serverUrlProxyTcp)) {
|
||||||
qWarning() << "Could not connect client two";
|
qWarning() << "Could not connect client two";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user