Crate of the Week

tokio-netem provides a toolbox of Tokio AsyncRead /AsyncWrite adapters that let you emulate latency, throttling, slicing, terminations, forced shutdowns, data injections and data corruption without touching your application code. Compose them around TcpStream (or any Tokio I/O type) to run realistic integration tests and chaos experiments.

let mut stream = TcpStream::connect("localhost:80")
    .await?
    .throttle_writes(32 * 1024) // 32 KB/s`
    .slice_writes(16); // flush writes every 16B
5 Likes