aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2025-01-23 13:24:03 +0100
committerLoïc Hoguin <[email protected]>2025-01-23 13:24:03 +0100
commit536aa68ce51354de775f875dd49109ae6fa3a9cb (patch)
treee4a80f9dc7153d1b593fa16a951df35af12a8282 /test
parent7335184d0de59166b68e5b0bbb86ca40c3d4e5d0 (diff)
downloadranch-536aa68ce51354de775f875dd49109ae6fa3a9cb.tar.gz
ranch-536aa68ce51354de775f875dd49109ae6fa3a9cb.tar.bz2
ranch-536aa68ce51354de775f875dd49109ae6fa3a9cb.zip
Fix DTLS
Options invalid for DTLS were given to ssl. Now they are only given for TLS. The {packet,raw} option is no longer set because the default for TLS is the equivalent {packet,0} and DTLS doesn't accept it.
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index 0f96fae..85fde04 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -83,6 +83,7 @@ groups() ->
ssl_active_n_echo,
ssl_echo,
ssl_local_echo,
+ ssl_dtls_echo,
ssl_graceful,
ssl_handshake,
ssl_handshake_error,
@@ -840,6 +841,27 @@ ssl_echo(_) ->
{'EXIT', _} = begin catch ranch:get_port(Name) end,
ok.
+ssl_dtls_echo(_) ->
+ doc("Ensure that passive mode works with SSL transport."),
+ Name = name(),
+ %% We are using DTLS so the version should be 'dtlsv1.2'.
+ %% But since we don't really need it we simply don't set 'versions'.
+ Opts = ct_helper:get_certs_from_ets() -- [{versions, ['tlsv1.2']}],
+ {ok, _} = ranch:start_listener(Name,
+ ranch_ssl, Opts ++ [{protocol, dtls}, {verify, verify_none}],
+ echo_protocol, []),
+ Port = ranch:get_port(Name),
+ {ok, Socket} = ssl:connect("localhost", Port, [
+ binary, {active, false}, {protocol, dtls},
+ {verify, verify_none}]),
+ ok = ssl:send(Socket, <<"SSL Ranch is working!">>),
+ {ok, <<"SSL Ranch is working!">>} = ssl:recv(Socket, 21, 1000),
+ ok = ranch:stop_listener(Name),
+ {error, closed} = ssl:recv(Socket, 0, 1000),
+ %% Make sure the listener stopped.
+ {'EXIT', _} = begin catch ranch:get_port(Name) end,
+ ok.
+
ssl_handshake(_) ->
doc("Ensure that multiple steps handshake works with SSL transport."),
Name = name(),