folly: AsyncSocketException: move implementation to .cpp, refactor
[folly.git] / folly / io / async / test / AsyncUDPSocketTest.cpp
index 09ebfcc1d8cf08865fb04983fc4ed73f02a28e78..575b9ee455b9e636bf52d5b3c3b1a1c2a178aab4 100644 (file)
  * limitations under the License.
  */
 
+#include <thread>
+
+#include <folly/Conv.h>
 #include <folly/SocketAddress.h>
+#include <folly/io/IOBuf.h>
 #include <folly/io/async/AsyncTimeout.h>
 #include <folly/io/async/AsyncUDPServerSocket.h>
 #include <folly/io/async/AsyncUDPSocket.h>
 #include <folly/io/async/EventBase.h>
-
-#include <folly/io/IOBuf.h>
+#include <folly/portability/GMock.h>
 #include <folly/portability/GTest.h>
 
-#include <thread>
-
 using folly::AsyncUDPSocket;
 using folly::AsyncUDPServerSocket;
 using folly::AsyncTimeout;
 using folly::EventBase;
 using folly::SocketAddress;
 using folly::IOBuf;
+using namespace testing;
 
 class UDPAcceptor
     : public AsyncUDPServerSocket::Callback {
@@ -289,3 +291,10 @@ TEST(AsyncSocketTest, PingPong) {
   // Wait for server thread to joib
   serverThread.join();
 }
+
+class TestAsyncUDPSocket : public AsyncUDPSocket {
+ public:
+  explicit TestAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
+
+  MOCK_METHOD3(sendmsg, ssize_t(int, const struct msghdr*, int));
+};