/// Run this client asynchronously. This tries to connect to the configured
/// server.
Run this client asynchronously. This tries to connect to the configured
server.
Run this client asynchronously . This tries to connect to the configured server .
pub async fn run(self, server_port: u16) {
        let tcp_stream = TcpStream::connect(("127.0.0.1", server_port))
            .await
            .expect("failed to connect");
        let tls_connector = self.tls_connector();
        let tls_state = tls_connector
            .into_ssl("domain is irrelevant, because hostname verification is disabled")
            .expect("failed to convert TLS connector 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).connect().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 client error to contain \"{}\" but got error: {:?}",
                    expected_error, error
                )
            }
        } else {
            match result {
                Err(error) => panic!(
                    "expected the client result to be ok but got error: {}",
                    error
                ),
                Ok(()) => {
                    let (mut tls_read_half, tls_write_half) = tokio::io::split(tls_stream);
                    self.expect_msg_from_server_if_configured(&mut tls_read_half)
                        .await;
                }
            }
        }
    }
pub async fn run ( self , server_port : u16 ) { let tcp_stream = TcpStream :: connect ( ( " " , server_port ) ) . await . expect ( " " ) ; let tls_connector = self . tls_connector ( ) ; let tls_state = tls_connector . into_ssl ( " " ) . expect ( " " ) ; let mut tls_stream = tokio_openssl :: SslStream :: new ( tls_state , tcp_stream ) . expect ( " " ) ; let result = Pin :: new ( & mut tls_stream ) . connect ( ) . 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 { match result { Err ( error ) => panic ! ( " " error ) , Ok ( ( ) ) => { let ( mut tls_read_half , tls_write_half ) = tokio :: io :: split ( tls_stream ) ; self . expect_msg_from_server_if_configured ( & mut tls_read_half ) . await ; } } } }
Run this client asynchronously.
Run this client asynchronously .
self
server_port
u16