fix websocket server tests
This commit is contained in:
parent
b0098701d4
commit
2d33034a12
@ -40,6 +40,8 @@ class TestWebSocketServer: public GuhTestBase
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void initTestCase();
|
||||||
|
|
||||||
void testHandshake();
|
void testHandshake();
|
||||||
|
|
||||||
void pingTest();
|
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()
|
void TestWebSocketServer::testHandshake()
|
||||||
{
|
{
|
||||||
QWebSocket *socket = new QWebSocket("guh tests", QWebSocketProtocol::Version13);
|
QWebSocket *socket = new QWebSocket("guh tests", QWebSocketProtocol::Version13);
|
||||||
|
|||||||
Reference in New Issue
Block a user