async fn request_channel_can_be_cancelled_by_client(client: Client) {
        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("0")
        );

        let mut results = client.request_channel(
            stream!{ yield Ok(Payload::from("")) }.boxed()
        );
        let payload = results.next().await.expect("valid payload").unwrap();
        assert_eq!(payload.metadata_utf8(), Some("subscribers: 1"));
        assert_eq!(payload.data_utf8(), Some("0"));

        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("1")
        );

        debug!("when the Flux is dropped");
        drop(results);
        // Give the server enough time to receive the CANCEL frame
        tokio::time::sleep(Duration::from_millis(250)).await;

        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("0")
        );
    }
///
/// Client requests a stream, consumes an item and drops the stream handle.
///
/// Amount of active streams is verified before and after requesting and after dropping.
///
/// Before request_channel: 0 subscribers
/// When request_channel is called: 1 subscriber
/// When request_channel handle is dropped: 0 subscribers
Client requests a stream, consumes an item and drops the stream handle.
Amount of active streams is verified before and after requesting and after dropping.

Before request_channel: 0 subscribers
When request_channel is called: 1 subscriber
When request_channel handle is dropped: 0 subscribers
Client requests a stream consumes an item and drops the stream handle . Amount of active streams is verified before and after requesting and after dropping . Before request_channel : 0 subscribers When request_channel is called : 1 subscriber When request_channel handle is dropped : 0 subscribers
async fn request_channel_can_be_cancelled_by_client(client: Client) {
        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("0")
        );
        let mut results = client.request_channel(
            stream!{ yield Ok(Payload::from("")) }.boxed()
        );
        let payload = results.next().await.expect("valid payload").unwrap();
        assert_eq!(payload.metadata_utf8(), Some("subscribers: 1"));
        assert_eq!(payload.data_utf8(), Some("0"));
        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("1")
        );
        debug!("when the Flux is dropped");
        drop(results);
        // Give the server enough time to receive the CANCEL frame
        tokio::time::sleep(Duration::from_millis(250)).await;
        assert_eq!(
            client.request_response(Payload::from("subscribers")).await.unwrap().unwrap().data_utf8(),
            Some("0")
        );
    }
async fn request_channel_can_be_cancelled_by_client ( client : Client ) { assert_eq ! ( client request_response ( Payload from ( " " ) ) await unwrap ( ) unwrap ( ) data_utf8 ( ) Some ( " " ) ) ; let mut results = client . request_channel ( stream ! { yield Ok ( Payload from ( " " ) ) } . boxed ( ) ) ; let payload = results . next ( ) . await . expect ( " " ) . unwrap ( ) ; assert_eq ! ( payload metadata_utf8 ( ) Some ( " " ) ) ; assert_eq ! ( payload data_utf8 ( ) Some ( " " ) ) ; assert_eq ! ( client request_response ( Payload from ( " " ) ) await unwrap ( ) unwrap ( ) data_utf8 ( ) Some ( " " ) ) ; debug ! ( " " ) ; drop ( results ) ; // Give the server enough time to receive the CANCEL frame tokio :: time :: sleep ( Duration :: from_millis ( 250 ) ) . await ; assert_eq ! ( client request_response ( Payload from ( " " ) ) await unwrap ( ) unwrap ( ) data_utf8 ( ) Some ( " " ) ) ; }
Client requests a stream, consumes an item and drops the stream handle.
Client requests a stream consumes an item and drops the stream handle .
client
Client
client
Client