proxygen
ScopedServerTest Class Reference
Inheritance diagram for ScopedServerTest:
testing::Test ConnectionFilterTest

Public Member Functions

void SetUp () override
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Protected Member Functions

std::unique_ptr< ScopedHTTPServercreateScopedServer ()
 
std::unique_ptr< CurlClientconnectSSL (const std::string &caFile="", const std::string &certFile="", const std::string &keyFile="")
 
std::unique_ptr< CurlClientconnectPlainText ()
 
virtual HTTPServerOptions createDefaultOpts ()
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 

Protected Attributes

folly::EventBase evb_
 
folly::SocketAddress address_
 
HHWheelTimer::UniquePtr timer_
 
HTTPServer::IPConfig cfg_
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 584 of file HTTPServerTest.cpp.

Member Function Documentation

std::unique_ptr<CurlClient> ScopedServerTest::connectPlainText ( )
inlineprotected

Definition at line 625 of file HTTPServerTest.cpp.

References proxygen::HTTPConnector::connect(), evb_, and timer_.

625  {
626  URL url(
627  folly::to<std::string>("http://localhost:", address_.getPort()));
628  HTTPHeaders headers;
629  auto client = std::make_unique<CurlClient>(
630  &evb_, HTTPMethod::GET, url, nullptr, headers, "");
631  client->setFlowControlSettings(64 * 1024);
632  client->setLogging(false);
633  HTTPConnector connector(client.get(), timer_.get());
634  connector.connect(
635  &evb_,
636  address_,
637  std::chrono::milliseconds(1000));
638  evb_.loop();
639  return client;
640  }
folly::EventBase evb_
HHWheelTimer::UniquePtr timer_
uint16_t getPort() const
folly::SocketAddress address_
void connect(folly::EventBase *eventBase, const folly::SocketAddress &connectAddr, std::chrono::milliseconds timeoutMs=std::chrono::milliseconds(0), const folly::AsyncSocket::OptionMap &socketOptions=folly::AsyncSocket::emptyOptionMap, const folly::SocketAddress &bindAddr=folly::AsyncSocket::anyAddress())
std::unique_ptr<CurlClient> ScopedServerTest::connectSSL ( const std::string caFile = "",
const std::string certFile = "",
const std::string keyFile = "" 
)
inlineprotected

Definition at line 604 of file HTTPServerTest.cpp.

References proxygen::HTTPConnector::connectSSL(), evb_, and timer_.

606  {
607  URL url(folly::to<std::string>("https://localhost:", address_.getPort()));
608  HTTPHeaders headers;
609  auto client = std::make_unique<CurlClient>(
610  &evb_, HTTPMethod::GET, url, nullptr, headers, "");
611  client->setFlowControlSettings(64 * 1024);
612  client->setLogging(false);
613  client->initializeSsl(caFile, "http/1.1", certFile, keyFile);
614  HTTPConnector connector(client.get(), timer_.get());
615  connector.connectSSL(
616  &evb_,
617  address_,
618  client->getSSLContext(),
619  nullptr,
620  std::chrono::milliseconds(1000));
621  evb_.loop();
622  return client;
623  }
folly::EventBase evb_
HHWheelTimer::UniquePtr timer_
uint16_t getPort() const
folly::SocketAddress address_
void connectSSL(folly::EventBase *eventBase, const folly::SocketAddress &connectAddr, const std::shared_ptr< folly::SSLContext > &ctx, SSL_SESSION *session=nullptr, std::chrono::milliseconds timeoutMs=std::chrono::milliseconds(0), const folly::AsyncSocket::OptionMap &socketOptions=folly::AsyncSocket::emptyOptionMap, const folly::SocketAddress &bindAddr=folly::AsyncSocket::anyAddress(), const std::string &serverName=empty_string)
virtual HTTPServerOptions ScopedServerTest::createDefaultOpts ( )
inlineprotectedvirtual
std::unique_ptr<ScopedHTTPServer> ScopedServerTest::createScopedServer ( )
inlineprotected

Definition at line 596 of file HTTPServerTest.cpp.

References folly::gen::move, and start.

596  {
597  auto opts = createDefaultOpts();
598  auto res = ScopedHTTPServer::start(cfg_, std::move(opts));
599  auto addresses = res->getAddresses();
600  address_ = addresses.front().address;
601  return res;
602  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::SocketAddress address_
HTTPServer::IPConfig cfg_
virtual HTTPServerOptions createDefaultOpts()
auto start
void ScopedServerTest::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 586 of file HTTPServerTest.cpp.

References folly::HHWheelTimer::DEFAULT_TICK_INTERVAL, evb_, folly::TimeoutManager::NORMAL, and timer_.

586  {
587  timer_.reset(new HHWheelTimer(
588  &evb_,
589  std::chrono::milliseconds(HHWheelTimer::DEFAULT_TICK_INTERVAL),
590  AsyncTimeout::InternalEnum::NORMAL,
591  std::chrono::milliseconds(1000)));
592  }
folly::EventBase evb_
HHWheelTimer::UniquePtr timer_

Member Data Documentation

folly::SocketAddress ScopedServerTest::address_
protected

Definition at line 651 of file HTTPServerTest.cpp.

HTTPServer::IPConfig ScopedServerTest::cfg_
protected
Initial value:
{
folly::SocketAddress("127.0.0.1", 0),
HTTPServer::Protocol::HTTP}

Definition at line 653 of file HTTPServerTest.cpp.

folly::EventBase ScopedServerTest::evb_
protected

Definition at line 650 of file HTTPServerTest.cpp.

HHWheelTimer::UniquePtr ScopedServerTest::timer_
protected

Definition at line 652 of file HTTPServerTest.cpp.


The documentation for this class was generated from the following file: