diff --git a/tests/auto/websocketserver/testwebsocketserver.cpp b/tests/auto/websocketserver/testwebsocketserver.cpp index 39a1de12..ba1721b6 100644 --- a/tests/auto/websocketserver/testwebsocketserver.cpp +++ b/tests/auto/websocketserver/testwebsocketserver.cpp @@ -40,6 +40,8 @@ class TestWebSocketServer: public GuhTestBase Q_OBJECT private slots: + void initTestCase(); + void testHandshake(); void pingTest(); @@ -63,6 +65,28 @@ private: }; +void TestWebSocketServer::initTestCase() +{ + GuhTestBase::initTestCase(); + + ServerConfiguration config; + foreach (const ServerConfiguration &c, GuhCore::instance()->configuration()->webSocketServerConfigurations()) { + if (c.port == 4444 && (c.address == QHostAddress("127.0.0.1") || c.address == QHostAddress("0.0.0.0"))) { + qDebug() << "Already have a websocketserver listening on 127.0.0.1:4444"; + config = c; + break; + } + } + + qDebug() << "Creating new websocketserver instance on 127.0.0.1:4444"; + config.address = QHostAddress("127.0.0.1"); + config.port = 4444; + config.sslEnabled = true; + config.authenticationEnabled = true; + GuhCore::instance()->configuration()->setWebSocketServerConfiguration(config); + +} + void TestWebSocketServer::testHandshake() { QWebSocket *socket = new QWebSocket("guh tests", QWebSocketProtocol::Version13);