-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathhttp2_spec_5_5_SUITE.erl
49 lines (40 loc) · 1.16 KB
/
http2_spec_5_5_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
41
42
43
44
45
46
47
48
49
-module(http2_spec_5_5_SUITE).
-include("http2.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
-compile([export_all]).
all() ->
[
sends_unknown_extension_frame
].
init_per_suite(Config) ->
application:ensure_started(crypto),
chatterbox_test_buddy:start(Config).
end_per_suite(Config) ->
chatterbox_test_buddy:stop(Config),
ok.
sends_unknown_extension_frame(_Config) ->
{ok, Client} = http2c:start_link(),
%% Some FF type frame that doesn't exist
Bin = <<16#00,16#00,16#01,16#ff,16#00,16#00,16#00,16#00,16#00,
16#00>>,
http2c:send_binary(Client, Bin),
%% It should be ignored, so let's send a ping and get one back
Data = crypto:strong_rand_bytes(8),
http2c:send_unaltered_frames(
Client,
[
{#frame_header{
type=?PING,
stream_id=0,
length=8
},
h2_frame_ping:new(Data)
}
]),
Resp = http2c:wait_for_n_frames(Client, 0, 1),
ct:pal("Resp: ~p", [Resp]),
?assertEqual(1, (length(Resp))),
[{PingH, _PingBody}] = Resp,
?assertEqual(?PING, (PingH#frame_header.type)),
ok.