Commit 63aca181 authored by knowledge4igor's avatar knowledge4igor

Add address reuse in http client test

parent 61af27cb
#include "gtest/gtest.h"
#include <pistache/http.h>
#include <pistache/client.h>
#include <pistache/endpoint.h>
#include "gtest/gtest.h"
#include <chrono>
using namespace Pistache;
......@@ -11,9 +11,8 @@ using namespace Pistache;
struct HelloHandler : public Http::Handler {
HTTP_PROTOTYPE(HelloHandler)
void onRequest(const Http::Request& request, Http::ResponseWriter writer)
void onRequest(const Http::Request& /*request*/, Http::ResponseWriter writer)
{
UNUSED(request)
writer.send(Http::Code::Ok, "Hello, World!");
}
};
......@@ -22,7 +21,8 @@ TEST(request_builder, multiple_send_test) {
const std::string address = "localhost:9080";
Http::Endpoint server(address);
auto server_opts = Http::Endpoint::options().threads(1);
auto flags = Tcp::Options::InstallSignalHandler | Tcp::Options::ReuseAddr;
auto server_opts = Http::Endpoint::options().flags(flags).threads(1);
server.init(server_opts);
server.setHandler(Http::make_handler<HelloHandler>());
server.serveThreaded();
......@@ -54,4 +54,4 @@ TEST(request_builder, multiple_send_test) {
client.shutdown();
ASSERT_TRUE(response_counter == RESPONSE_SIZE);
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment