-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cc
46 lines (36 loc) · 1.06 KB
/
test.cc
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
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include "scheduler.hpp"
#include "bhttp.hpp"
using namespace std;
void doLongPoll(BHttp& http) {
for (auto i = 0; i < 4; ++i) {
cout << http.doGet("/longpoll").get() << endl;
}
}
void doGets(BHttp& http) {
for (auto i = 0; i < 20; ++i) {
cout << http.doGet("/").get() << endl;
}
}
void doPosts(BHttp& http) {
for (auto i = 0; i < 20; ++i) {
cout << http.doPost("/").get() << endl;
}
}
boost::mutex m;
boost::condition_variable cond;
Scheduler master_scheduler;
int main(int argc, char* argv[]) {
//auto sslContext = BHttp::createSslContext("");
auto sslContext = BHttp::createDummySslContext(); //BHttp::createSslContext("");
BHttp http(master_scheduler, "localhost", "8070", sslContext, true);
http.connect();
std::cout << http.doGet("/").get() << std::endl;
std::cout << http.doGet("/").get() << std::endl;
//boost::thread thread1([&http]() { doLongPoll(http); });
//boost::thread thread2([&http]() { doPosts(http); });
//thread1.join();
//thread3.join();
}