forked from rsocket/rsocket-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRSocketClientTest.cpp
More file actions
28 lines (21 loc) · 833 Bytes
/
RSocketClientTest.cpp
File metadata and controls
28 lines (21 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2004-present Facebook. All Rights Reserved.
#include "RSocketTests.h"
#include <folly/io/async/ScopedEventBaseThread.h>
#include <gtest/gtest.h>
#include "rsocket/transports/tcp/TcpConnectionFactory.h"
using namespace rsocket;
using namespace rsocket::tests;
using namespace rsocket::tests::client_server;
TEST(RSocketClient, ConnectFails) {
folly::ScopedEventBaseThread worker;
folly::SocketAddress address;
address.setFromHostPort("localhost", 1);
auto client = RSocket::createConnectedClient(
std::make_unique<TcpConnectionFactory>(*worker.getEventBase(),
std::move(address)));
client.then([&](auto&) {
FAIL() << "the test needs to fail";
}).onError([&](const std::exception&) {
LOG(INFO) << "connection failed as expected";
}).get();
}