aboutsummaryrefslogtreecommitdiffstats
path: root/test/http2_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/http2_SUITE.erl')
-rw-r--r--test/http2_SUITE.erl25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/http2_SUITE.erl b/test/http2_SUITE.erl
index d17508a..6f2d020 100644
--- a/test/http2_SUITE.erl
+++ b/test/http2_SUITE.erl
@@ -1,4 +1,4 @@
-%% Copyright (c) 2017-2024, Loïc Hoguin <[email protected]>
+%% Copyright (c) Loïc Hoguin <[email protected]>
%%
%% Permission to use, copy, modify, and/or distribute this software for any
%% purpose with or without fee is hereby granted, provided that the above
@@ -51,6 +51,27 @@ do_handshake(Settings, Config) ->
{ok, << 0:24, 4:8, 1:8, 0:32 >>} = gen_tcp:recv(Socket, 9, 1000),
{ok, Socket}.
+hibernate(Config) ->
+ doc("Ensure that we can enable hibernation for HTTP/1.1 connections."),
+ {ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], #{
+ env => #{dispatch => init_dispatch(Config)},
+ hibernate => true
+ }),
+ Port = ranch:get_port(?FUNCTION_NAME),
+ try
+ ConnPid = gun_open([{type, tcp}, {protocol, http2}, {port, Port}|Config]),
+ {ok, http2} = gun:await_up(ConnPid),
+ StreamRef1 = gun:get(ConnPid, "/"),
+ StreamRef2 = gun:get(ConnPid, "/"),
+ StreamRef3 = gun:get(ConnPid, "/"),
+ {response, nofin, 200, _} = gun:await(ConnPid, StreamRef1),
+ {response, nofin, 200, _} = gun:await(ConnPid, StreamRef2),
+ {response, nofin, 200, _} = gun:await(ConnPid, StreamRef3),
+ gun:close(ConnPid)
+ after
+ cowboy:stop_listener(?FUNCTION_NAME)
+ end.
+
idle_timeout(Config) ->
doc("Terminate when the idle timeout is reached."),
ProtoOpts = #{
@@ -449,8 +470,8 @@ graceful_shutdown_listener_timeout(Config) ->
send_timeout_close(Config) ->
doc("Check that connections are closed on send timeout."),
TransOpts = #{
- port => 0,
socket_opts => [
+ {port, 0},
{send_timeout, 100},
{send_timeout_close, true},
{sndbuf, 10}