From 212acf0bb8fa6f500c76329ddb15e7f989e71915 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 25 Jun 2015 23:07:25 -0700 Subject: Add a test for connection negotiation failure --- openssl/src/ssl/tests.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'openssl/src') diff --git a/openssl/src/ssl/tests.rs b/openssl/src/ssl/tests.rs index 028d9f09..dcaee215 100644 --- a/openssl/src/ssl/tests.rs +++ b/openssl/src/ssl/tests.rs @@ -23,6 +23,8 @@ use crypto::pkey::PKey; use std::net::UdpSocket; #[cfg(feature="dtlsv1")] use ssl::SslMethod::Dtlsv1; +#[cfg(feature="sslv2")] +use ssl::SslMethod::Sslv2; #[cfg(feature="dtlsv1")] use connected_socket::Connect; @@ -447,7 +449,7 @@ fn test_connect_with_npn_successful_single_match() { #[test] #[cfg(feature = "npn")] fn test_npn_server_advertise_multiple() { - let localhost = "127.0.0.1:15420"; + let localhost = "127.0.0.1:15450"; let listener = TcpListener::bind(localhost).unwrap(); // We create a different context instance for the server... let listener_ctx = { @@ -516,3 +518,10 @@ fn test_read_dtlsv1() { let mut buf = [0u8;100]; assert!(stream.read(&mut buf).is_ok()); } + +#[test] +#[cfg(feature = "sslv2")] +fn test_sslv2_connect_failure() { + let tcp = TcpStream::connect("127.0.0.1:15420").unwrap(); + SslStream::new(&SslContext::new(Sslv2).unwrap(), tcp).err().unwrap(); +} -- cgit v1.2.3