aboutsummaryrefslogtreecommitdiffstats
path: root/test/cowboy_test.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/cowboy_test.erl')
-rw-r--r--test/cowboy_test.erl28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/cowboy_test.erl b/test/cowboy_test.erl
index 786eab6..4cb2a33 100644
--- a/test/cowboy_test.erl
+++ b/test/cowboy_test.erl
@@ -49,6 +49,34 @@ all(Suite) ->
string:substr(atom_to_list(F), 1, 3) =/= "do_"
]).
+%% Listeners initialization.
+
+init_http(Ref, ProtoOpts, Config) ->
+ {ok, _} = cowboy:start_http(Ref, 100, [{port, 0}], [
+ {max_keepalive, 50},
+ {timeout, 500}
+ |ProtoOpts]),
+ Port = ranch:get_port(Ref),
+ [{type, tcp}, {port, Port}, {opts, []}|Config].
+
+init_https(Ref, ProtoOpts, Config) ->
+ {_, Cert, Key} = ct_helper:make_certs(),
+ Opts = [{cert, Cert}, {key, Key}],
+ {ok, _} = cowboy:start_https(Ref, 100, Opts ++ [{port, 0}], [
+ {max_keepalive, 50},
+ {timeout, 500}
+ |ProtoOpts]),
+ Port = ranch:get_port(Ref),
+ [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+
+init_spdy(Ref, ProtoOpts, Config) ->
+ {_, Cert, Key} = ct_helper:make_certs(),
+ Opts = [{cert, Cert}, {key, Key}],
+ {ok, _} = cowboy:start_spdy(Ref, 100, Opts ++ [{port, 0}],
+ ProtoOpts),
+ Port = ranch:get_port(Ref),
+ [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+
%% Support functions for testing using Gun.
gun_open(Config) ->