summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/proxypac/proxyserver.h
blob: c95856da95465ae0ccfc9f5dc59d2f0429ecd940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef PROXY_SERVER_H
#define PROXY_SERVER_H

#include <QObject>
#include <QTcpServer>

class ProxyServer : public QObject
{
    Q_OBJECT

public:
    explicit ProxyServer(QObject *parent = nullptr);

    void setPort(int port);
    bool isListening();

signals:
    void requestReceived();

public slots:
    void run();

private slots:
    void handleNewConnection();
    void handleReadReady();

private:
    int m_port;
    QByteArray m_data;
    QTcpServer m_server;

};

#endif // PROXY_SERVER_H