|
|
@ -1,6 +1,10 @@ |
|
|
|
//! Verifies that the server returns a `ConnectionClosed` error when the connection
|
|
|
|
//! Verifies that the server returns a `ConnectionClosed` error when the connection
|
|
|
|
//! is closed from the server's point of view and drop the underlying tcp socket.
|
|
|
|
//! is closed from the server's point of view and drop the underlying tcp socket.
|
|
|
|
#![cfg(any(feature = "native-tls", feature = "rustls-tls"))] |
|
|
|
#![cfg(any(
|
|
|
|
|
|
|
|
feature = "native-tls", |
|
|
|
|
|
|
|
feature = "rustls-tls-native-roots", |
|
|
|
|
|
|
|
feature = "rustls-tls-webpki-roots" |
|
|
|
|
|
|
|
))] |
|
|
|
|
|
|
|
|
|
|
|
use std::{ |
|
|
|
use std::{ |
|
|
|
net::{TcpListener, TcpStream}, |
|
|
|
net::{TcpListener, TcpStream}, |
|
|
@ -15,7 +19,10 @@ use url::Url; |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "native-tls")] |
|
|
|
#[cfg(feature = "native-tls")] |
|
|
|
type Sock = WebSocket<Stream<TcpStream, native_tls_crate::TlsStream<TcpStream>>>; |
|
|
|
type Sock = WebSocket<Stream<TcpStream, native_tls_crate::TlsStream<TcpStream>>>; |
|
|
|
#[cfg(all(feature = "rustls-tls", not(feature = "native-tls")))] |
|
|
|
#[cfg(all(
|
|
|
|
|
|
|
|
any(feature = "rustls-tls-native-roots", feature = "rustls-tls-webpki-roots"), |
|
|
|
|
|
|
|
not(feature = "native-tls") |
|
|
|
|
|
|
|
))] |
|
|
|
type Sock = WebSocket<Stream<TcpStream, rustls::StreamOwned<rustls::ClientSession, TcpStream>>>; |
|
|
|
type Sock = WebSocket<Stream<TcpStream, rustls::StreamOwned<rustls::ClientSession, TcpStream>>>; |
|
|
|
|
|
|
|
|
|
|
|
fn do_test<CT, ST>(port: u16, client_task: CT, server_task: ST) |
|
|
|
fn do_test<CT, ST>(port: u16, client_task: CT, server_task: ST) |
|
|
|