//! UDP error-path integration tests. #[path = "../support/mod.rs"] mod support; mod helpers; use helpers::*; use niom_turn::alloc::AllocationManager; use support::init_tracing; use tokio::net::UdpSocket; use tokio::time::{timeout, Duration}; #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn malformed_packet_is_dropped_without_response() { init_tracing(); let auth = build_auth_manager(); let allocs = AllocationManager::new(); let server_addr = spawn_udp_server(auth, allocs).await; let client = UdpSocket::bind("127.0.0.1:0").await.expect("client bind"); client .send_to(&malformed_stun_frame(), server_addr) .await .expect("send malformed"); let mut buf = [0u8; 1500]; let recv = timeout(Duration::from_millis(200), client.recv_from(&mut buf)).await; assert!(recv.is_err(), "server should not respond to malformed frame"); }