aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_tls.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-03-20 04:32:15 +0000
committerlloyd <[email protected]>2015-03-20 04:32:15 +0000
commitb01ce65e09e50ec624bdbf62bf2c1433f0d6f637 (patch)
tree8aa46632eb381b44de64d106b62f8efad49c173d /src/tests/unit_tls.cpp
parent181e75b66d5fbffdce04d37014c260b4fab5dec8 (diff)
Add ALPN (RFC 7301) and remove NPN
Diffstat (limited to 'src/tests/unit_tls.cpp')
-rw-r--r--src/tests/unit_tls.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp
index aeab7cd4e..8e21cc484 100644
--- a/src/tests/unit_tls.cpp
+++ b/src/tests/unit_tls.cpp
@@ -176,6 +176,15 @@ size_t basic_test_handshake(RandomNumberGenerator& rng,
s2c_data.insert(s2c_data.end(), buf, buf+sz);
};
+ auto next_protocol_chooser = [&](std::vector<std::string> protos) {
+ if(protos.size() != 2)
+ std::cout << "Bad protocol size\n";
+ if(protos[0] != "test/1" || protos[1] != "test/2")
+ std::cout << "Bad protocol values\n";
+ return "test/3";
+ };
+ const std::vector<std::string> protocols_offered = { "test/1", "test/2" };
+
TLS::Server server([&](const byte buf[], size_t sz)
{ s2c_q.insert(s2c_q.end(), buf, buf+sz); },
save_server_data,
@@ -185,15 +194,7 @@ size_t basic_test_handshake(RandomNumberGenerator& rng,
creds,
policy,
rng,
- { "test/1", "test/2" });
-
- auto next_protocol_chooser = [&](std::vector<std::string> protos) {
- if(protos.size() != 2)
- std::cout << "Bad protocol size\n";
- if(protos[0] != "test/1" || protos[1] != "test/2")
- std::cout << "Bad protocol values\n";
- return "test/3";
- };
+ next_protocol_chooser);
TLS::Client client([&](const byte buf[], size_t sz)
{ c2s_q.insert(c2s_q.end(), buf, buf+sz); },
@@ -206,7 +207,7 @@ size_t basic_test_handshake(RandomNumberGenerator& rng,
rng,
TLS::Server_Information(),
offer_version,
- next_protocol_chooser);
+ protocols_offered);
while(true)
{