From 016f21f5b4e8e8dcca73e5d597ccd8f63f60c777 Mon Sep 17 00:00:00 2001 From: Alexey Galakhov Date: Fri, 31 Jan 2020 03:03:37 +0100 Subject: [PATCH] tests: do not report expected autobahn errors Signed-off-by: Alexey Galakhov --- examples/autobahn-client.rs | 9 ++++++--- examples/autobahn-server.rs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/autobahn-client.rs b/examples/autobahn-client.rs index 9b9460f..1110e1d 100644 --- a/examples/autobahn-client.rs +++ b/examples/autobahn-client.rs @@ -1,4 +1,4 @@ -use async_tungstenite::{async_std::connect_async, tungstenite::Result}; +use async_tungstenite::{async_std::connect_async, tungstenite::Error, tungstenite::Result}; use futures::{SinkExt, StreamExt}; use log::*; use url::Url; @@ -56,8 +56,11 @@ async fn run() { let total = get_case_count().await.expect("Error getting case count"); for case in 1..=total { - if let Err(err) = run_test(case).await { - error!("Testcase failed: {}", err); + if let Err(e) = run_test(case).await { + match e { + Error::ConnectionClosed | Error::Protocol(_) | Error::Utf8 => (), + err => error!("Testcase failed: {}", err), + } } } diff --git a/examples/autobahn-server.rs b/examples/autobahn-server.rs index 2030229..1d356a9 100644 --- a/examples/autobahn-server.rs +++ b/examples/autobahn-server.rs @@ -1,12 +1,15 @@ use async_std::net::{SocketAddr, TcpListener, TcpStream}; -use async_tungstenite::accept_async; +use async_tungstenite::{accept_async, tungstenite::Error}; use futures::{SinkExt, StreamExt}; use log::*; use tungstenite::Result; async fn accept_connection(peer: SocketAddr, stream: TcpStream) { - if let Err(err) = handle_connection(peer, stream).await { - error!("Error processing connection: {}", err); + if let Err(e) = handle_connection(peer, stream).await { + match e { + Error::ConnectionClosed | Error::Protocol(_) | Error::Utf8 => (), + err => error!("Error processing connection: {}", err), + } } }