16 #ifndef TENSORFLOW_SERVING_UTIL_NET_HTTP_CLIENT_TEST_CLIENT_INTERNAL_EVHTTP_CONNECTION_H_
17 #define TENSORFLOW_SERVING_UTIL_NET_HTTP_CLIENT_TEST_CLIENT_INTERNAL_EVHTTP_CONNECTION_H_
25 #include "absl/strings/string_view.h"
26 #include "absl/synchronization/notification.h"
27 #include "libevent/include/event2/buffer.h"
28 #include "libevent/include/event2/bufferevent.h"
29 #include "libevent/include/event2/event.h"
30 #include "libevent/include/event2/http.h"
31 #include "libevent/include/event2/keyvalq_struct.h"
32 #include "libevent/include/event2/util.h"
35 #include "tensorflow_serving/util/net_http/client/test_client/public/httpclient_interface.h"
36 #include "tensorflow_serving/util/net_http/server/public/httpserver_interface.h"
38 namespace tensorflow {
54 void Terminate()
override;
59 static std::unique_ptr<TestEvHTTPConnection> Connect(absl::string_view url);
63 static std::unique_ptr<TestEvHTTPConnection> Connect(absl::string_view host,
68 static std::unique_ptr<TestEvHTTPConnection> ConnectLocal(
int port) {
69 return Connect(
"localhost", port);
86 void SetExecutor(std::unique_ptr<EventExecutor> executor)
override;
89 struct event_base* ev_base_;
90 struct evhttp_uri* http_uri_;
91 struct evhttp_connection* evcon_;
93 std::unique_ptr<EventExecutor> executor_;
95 std::unique_ptr<absl::Notification> loop_exit_;