/// Run this client asynchronously. This allows a client to connect.
Run this client asynchronously. This allows a client to connect.
Run this client asynchronously . This allows a client to connect .
pub async fn run(self) {
        self.listener
            .set_nonblocking(true)
            .expect("failed to make listener non-blocking");
        let mut tokio_tcp_listener = TcpListener::from_std(self.listener.try_clone().unwrap())
            .expect("failed to create tokio TcpListener");
        let (tcp_stream, _peer_address) = tokio_tcp_listener
            .accept()
            .await
            .expect("failed to accept connection");
        let tls_acceptor = self.tls_acceptor();
        let tls_state = Ssl::new(tls_acceptor.context())
            .expect("failed to convert TLS acceptor to state object");
        let mut tls_stream = tokio_openssl::SslStream::new(tls_state, tcp_stream)
            .expect("failed to create tokio_openssl::SslStream");
        let result = Pin::new(&mut tls_stream).accept().await;
        if let Some(expected_error) = self.expected_error {
            let error = result.err().expect("expected error");
            if !error.to_string().contains(&expected_error) {
                panic!(
                    "expected the server error to contain \"{}\" but got error: {:?}",
                    expected_error, error
                )
            }
        } else if let Some(error) = result.err() {
            panic!(
                "expected the server result to be ok but got error: {}",
                error
            )
        }
    }
pub async fn run ( self ) { self . listener . set_nonblocking ( true ) . expect ( " " ) ; let mut tokio_tcp_listener = TcpListener :: from_std ( self . listener . try_clone ( ) . unwrap ( ) ) . expect ( " " ) ; let ( tcp_stream , _peer_address ) = tokio_tcp_listener . accept ( ) . await . expect ( " " ) ; let tls_acceptor = self . tls_acceptor ( ) ; let tls_state = Ssl :: new ( tls_acceptor . context ( ) ) . expect ( " " ) ; let mut tls_stream = tokio_openssl :: SslStream :: new ( tls_state , tcp_stream ) . expect ( " " ) ; let result = Pin :: new ( & mut tls_stream ) . accept ( ) . await ; if let Some ( expected_error ) = self . expected_error { let error = result . err ( ) . expect ( " " ) ; if ! error . to_string ( ) . contains ( & expected_error ) { panic ! ( " \" \" " expected_error error ) } } else if let Some ( error ) = result . err ( ) { panic ! ( " " error ) } }
Run this client asynchronously.
Run this client asynchronously .
self