mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Move listener initialization to cowboy_test
This commit is contained in:
parent
b377eb9805
commit
25a17a2590
4 changed files with 65 additions and 59 deletions
|
@ -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) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue