Use into_split() in test
This commit is contained in:
parent
904e53f6de
commit
e2f38468c7
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "async-psec"
|
name = "async-psec"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
authors = ["Hardcore Sushi <hardcore.sushi@disroot.org>"]
|
authors = ["Hardcore Sushi <hardcore.sushi@disroot.org>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Asynchronous PSEC implementation"
|
description = "Asynchronous PSEC implementation"
|
||||||
|
@ -23,9 +23,11 @@ async fn tokio_main() {
|
|||||||
session.encrypt_and_send(b"Hello I'm Bob", true).await.unwrap();
|
session.encrypt_and_send(b"Hello I'm Bob", true).await.unwrap();
|
||||||
assert_eq!(session.receive_and_decrypt().await.unwrap(), b"Hello I'm Alice");
|
assert_eq!(session.receive_and_decrypt().await.unwrap(), b"Hello I'm Alice");
|
||||||
|
|
||||||
session.encrypt_and_send("!".repeat(997).as_bytes(), true).await.unwrap();
|
let (mut reader, mut writer) = session.into_split().unwrap();
|
||||||
|
|
||||||
assert_eq!(session.receive_and_decrypt().await, Err(PsecError::TransmissionCorrupted));
|
writer.encrypt_and_send("!".repeat(997).as_bytes(), true).await.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(reader.receive_and_decrypt().await, Err(PsecError::TransmissionCorrupted));
|
||||||
});
|
});
|
||||||
|
|
||||||
let stream = TcpStream::connect(format!("127.0.0.1:{}", bind_addr.port())).await.unwrap();
|
let stream = TcpStream::connect(format!("127.0.0.1:{}", bind_addr.port())).await.unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user