-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathstarting_SUITE.erl
40 lines (32 loc) · 1.08 KB
/
starting_SUITE.erl
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
29
30
31
32
33
34
35
36
37
38
39
40
-module(starting_SUITE).
%%-include("http2.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
-compile([export_all]).
all() ->
[identifies_protocol].
identifies_protocol(Config) ->
chatterbox_test_buddy:start([{ssl, true}|Config]),
{ok, Port} = application:get_env(chatterbox, port),
ClientOptions = [
binary,
{packet, raw},
{active, false}
],
{ok, SSLOptions} = application:get_env(chatterbox, ssl_options),
Options = ClientOptions ++ SSLOptions ++ [{alpn_advertised_protocols, [<<"h2">>]}],
{ok, Socket} = ssl:connect("localhost", Port, Options),
cthr:pal("Socket to me: ~p", [Socket]),
try ssl:negotiated_protocol(Socket) of
{ok, NextProtocol} ->
cthr:pal("NextProtocol: ~p", [NextProtocol]),
<<"h2">> = NextProtocol,
?assertEqual(<<"h2">>, NextProtocol)
catch
E:M ->
cthr:pal("~p:~p", [E,M])
end,
ok.
end_per_testcase(_, Config) ->
chatterbox_test_buddy:stop(Config),
ok.