This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-core/tests/auto/mocktcpserver.h
2014-01-26 17:12:15 +01:00

38 lines
864 B
C++

#ifndef MOCKTCPSERVER_H
#define MOCKTCPSERVER_H
#include <QObject>
#include <QNetworkInterface>
#include <QDebug>
class MockTcpServer : public QObject
{
Q_OBJECT
public:
explicit MockTcpServer(QObject *parent = 0);
~MockTcpServer();
void sendResponse(int clientId, const QByteArray &data);
/************** Used for testing **************************/
static QList<MockTcpServer*> servers();
void injectData(int clientId, const QByteArray &data);
signals:
void outgoingData(int clientId, const QByteArray &data);
/************** Used for testing **************************/
signals:
void jsonDataAvailable(int clientId, const QByteArray &data);
public slots:
bool startServer();
bool stopServer();
void sendToAll(QByteArray data);
private:
static QList<MockTcpServer*> s_allServers;
};
#endif // TCPSERVER_H