diff stream_ssl_alpn.t @ 1864:46351d990aee

Tests: simplified stream SSL tests with IO::Socket::SSL. The stream SSL tests which previously used IO::Socket::SSL were converted to use infrastructure in Test::Nginx::Stream where appropriate.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 18 May 2023 18:07:15 +0300
parents 58951cf933e1
children 2a0a6035a1af
line wrap: on
line diff
--- a/stream_ssl_alpn.t
+++ b/stream_ssl_alpn.t
@@ -100,25 +100,12 @@ like($t->read_file('test.log'), qr/500$/
 
 sub get_ssl {
 	my (@alpn) = @_;
-	my $s = stream('127.0.0.1:' . port(8080));
 
-	eval {
-		local $SIG{ALRM} = sub { die "timeout\n" };
-		local $SIG{PIPE} = sub { die "sigpipe\n" };
-		alarm(8);
-		IO::Socket::SSL->start_SSL($s->{_socket},
-			SSL_alpn_protocols => [ @alpn ],
-			SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
-			SSL_error_trap => sub { die $_[1] }
-		);
-		alarm(0);
-	};
-	alarm(0);
-
-	if ($@) {
-		log_in("died: $@");
-		return undef;
-	}
+	my $s = stream(
+		PeerAddr => '127.0.0.1:' . port(8080),
+		SSL => 1,
+		SSL_alpn_protocols => [ @alpn ]
+	);
 
 	return $s->read();
 }