mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 12:35:28 +00:00
transform panicking test into non-panicking test
This commit is contained in:
parent
3ffe89b775
commit
d1d3f0cbb5
1 changed files with 10 additions and 3 deletions
|
|
@ -274,12 +274,11 @@ fn serve_secret() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "AlertReceived(ProtocolVersion)")]
|
|
||||||
/// - if TLSv1.3 is selected, does not accept TLSv1.2 connections
|
/// - if TLSv1.3 is selected, does not accept TLSv1.2 connections
|
||||||
/// (lower versions do not have to be tested because rustls does not even
|
/// (lower versions do not have to be tested because rustls does not even
|
||||||
/// support them, making agate incapable of accepting them)
|
/// support them, making agate incapable of accepting them)
|
||||||
fn explicit_tls_version() {
|
fn explicit_tls_version() {
|
||||||
use rustls::{ClientSession, ProtocolVersion};
|
use rustls::{ClientSession, ProtocolVersion, TLSError};
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
|
|
||||||
|
|
@ -295,7 +294,15 @@ fn explicit_tls_version() {
|
||||||
let mut tls = rustls::Stream::new(&mut session, &mut tcp);
|
let mut tls = rustls::Stream::new(&mut session, &mut tcp);
|
||||||
|
|
||||||
let mut buf = [0; 10];
|
let mut buf = [0; 10];
|
||||||
tls.read(&mut buf).unwrap();
|
assert_eq!(
|
||||||
|
*tls.read(&mut buf)
|
||||||
|
.unwrap_err()
|
||||||
|
.into_inner()
|
||||||
|
.unwrap()
|
||||||
|
.downcast::<TLSError>()
|
||||||
|
.unwrap(),
|
||||||
|
TLSError::AlertReceived(rustls::internal::msgs::enums::AlertDescription::ProtocolVersion)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue