pub async fn http_connect_tokio_with_basic_auth<IO>(
    io: &mut IO,
    host: &str,
    port: u16,
    username: &str,
    password: &str
) -> Result<(), HttpError> where
    IO: AsyncRead + AsyncWrite + Unpin
This is supported on crate features runtime-tokio and basic-auth only.
Expand description

Connect to the server defined by the host and port with basic auth and check if the connection
was established.

The functions will use HTTP CONNECT request and the tokio runtime.

Example

use async_http_proxy::http_connect_tokio_with_basic_auth; use std::error::Error; use tokio::net::TcpStream; // Features “runtime-tokio” and “basic-auth” have to be activated #[tokio::main] async fn main() -> Result<(), Box> { let mut stream = TcpStream::connect(“127.0.0.1:8080”).await?; http_connect_tokio_with_basic_auth(&mut stream, “example.org”, 443, “username”, “password”) .await?; // stream is now connect to github.com Ok(()) }