From 9f84ac4d53c2b834b2ebffd98ea39eddc55f9f86 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 31 Oct 2023 09:42:36 -0600 Subject: [PATCH] Add explicit flush test --- src/stream.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/stream.rs b/src/stream.rs index 936291a..33335d6 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -950,6 +950,19 @@ pub(super) mod tests { Ok(()) } + /// Test that a flush before a handshake completes works. + #[tokio::test] + // #[ntest::timeout(60000)] + async fn test_flush_before_handshake() -> TestResult { + let (mut server, mut client) = + tls_pair().await; + server.write_all(b"hello?").await.unwrap(); + server.flush().await.unwrap(); + let mut buf = [0; 6]; + assert_eq!(6, client.read_exact(&mut buf).await.unwrap()); + Ok(()) + } + /// Test that the handshake works, and we get the correct ALPN negotiated values. #[tokio::test] #[ntest::timeout(60000)]