/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <chrono>
#include <thread>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-
#include <glog/logging.h>
-#include <gtest/gtest.h>
+
+#include <folly/portability/GTest.h>
+#include <folly/portability/Sockets.h>
using folly::ShutdownSocketSet;
+namespace fsp = folly::portability::sockets;
+
namespace folly { namespace test {
ShutdownSocketSet shutdownSocketSet;
: acceptSocket_(-1),
port_(0),
stop_(NO_STOP) {
- acceptSocket_ = socket(PF_INET, SOCK_STREAM, 0);
+ acceptSocket_ = fsp::socket(PF_INET, SOCK_STREAM, 0);
CHECK_ERR(acceptSocket_);
shutdownSocketSet.add(acceptSocket_);
}
int createConnectedSocket(int port) {
- int sock = socket(PF_INET, SOCK_STREAM, 0);
+ int sock = fsp::socket(PF_INET, SOCK_STREAM, 0);
CHECK_ERR(sock);
sockaddr_in addr;
addr.sin_family = AF_INET;
}
}} // namespaces
-
-int main(int argc, char *argv[]) {
- testing::InitGoogleTest(&argc, argv);
- gflags::ParseCommandLineFlags(&argc, &argv, true);
- return RUN_ALL_TESTS();
-}