forked from lavina/lavina
1
0
Fork 0
This commit is contained in:
Nikita Vilunov 2023-10-13 01:11:08 +02:00
parent ea1735bd92
commit 0ce1342032
1 changed files with 4 additions and 1 deletions

View File

@ -146,6 +146,7 @@ async fn scenario_basic() -> Result<()> {
let mut stream = TcpStream::connect(server.addr).await?; let mut stream = TcpStream::connect(server.addr).await?;
let mut s = TestScope::new(&mut stream); let mut s = TestScope::new(&mut stream);
tracing::info!("TCP connection established");
s.send(r#"<?xml version="1.0"?>"#).await?; s.send(r#"<?xml version="1.0"?>"#).await?;
s.send(r#"<stream:stream xmlns:stream="http://etherx.jabber.org/streams" to="127.0.0.1" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns="jabber:client" version="1.0">"#).await?; s.send(r#"<stream:stream xmlns:stream="http://etherx.jabber.org/streams" to="127.0.0.1" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns="jabber:client" version="1.0">"#).await?;
@ -159,6 +160,7 @@ async fn scenario_basic() -> Result<()> {
s.send(r#"<starttls/>"#).await?; s.send(r#"<starttls/>"#).await?;
assert_matches!(s.next_xml_event().await?, Event::Empty(b) => assert_eq!(b.local_name().into_inner(), b"proceed")); assert_matches!(s.next_xml_event().await?, Event::Empty(b) => assert_eq!(b.local_name().into_inner(), b"proceed"));
let buffer = s.buffer; let buffer = s.buffer;
tracing::info!("TLS feature negotiation complete");
let connector = TlsConnector::from(Arc::new( let connector = TlsConnector::from(Arc::new(
ClientConfig::builder() ClientConfig::builder()
@ -166,8 +168,9 @@ async fn scenario_basic() -> Result<()> {
.with_custom_certificate_verifier(Arc::new(IgnoreCertVerification)) .with_custom_certificate_verifier(Arc::new(IgnoreCertVerification))
.with_no_client_auth(), .with_no_client_auth(),
)); ));
tracing::debug!("Initiating TLS connection..."); tracing::info!("Initiating TLS connection...");
let mut stream = connector.connect(ServerName::IpAddress(server.addr.ip()), stream).await?; let mut stream = connector.connect(ServerName::IpAddress(server.addr.ip()), stream).await?;
tracing::info!("TLS connection established");
let mut s = TestScopeTls::new(&mut stream, buffer); let mut s = TestScopeTls::new(&mut stream, buffer);