MCPcopy Create free account
hub / github.com/apache/mesos / TEST_F

Function TEST_F

3rdparty/libprocess/src/tests/ssl_client.cpp:139–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139TEST_F(SSLClientTest, client)
140{
141 // Create the socket based on the 'use_ssl' flag. We use this to
142 // test whether a regular socket could connect to an SSL server
143 // socket.
144 const Try<Socket> create = Socket::create(
145 flags.use_ssl ? SocketImpl::Kind::SSL : SocketImpl::Kind::POLL);
146 ASSERT_SOME(create);
147
148 Socket socket = create.get();
149
150 Try<net::IP> ip = net::IP::parse(flags.server, AF_INET);
151 EXPECT_SOME(ip);
152
153 // Connect to the server.
154 Address address(ip.get(), flags.port);
155 Future<Nothing> connect = [&]() {
156 switch(socket.kind()) {
157 case SocketImpl::Kind::POLL:
158 return socket.connect(address);
159 case SocketImpl::Kind::SSL:
160 return socket.connect(
161 address,
162 openssl::create_tls_client_config(flags.server_hostname));
163 }
164 UNREACHABLE();
165 }();
166
167 // Verify that the client views the connection as established.
168 AWAIT_EXPECT_READY(connect);
169
170 // Send 'data' from the client to the server.
171 AWAIT_EXPECT_READY(socket.send(flags.data));
172
173 // Verify the client received the message back from the server.
174 AWAIT_EXPECT_EQ(flags.data, socket.recv());
175}
176
177#endif // USE_SSL_SOCKET

Callers

nothing calls this directly

Calls 8

create_tls_client_configFunction · 0.85
sendMethod · 0.65
createFunction · 0.50
parseFunction · 0.50
getMethod · 0.45
kindMethod · 0.45
connectMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected