fn zero_length_data() {
        let mut s = Session::default().unwrap();
        s.handshake().unwrap();

        let (stream, req) = s.send_request(false).unwrap();

        assert_eq!(
            s.client.send_body(&mut s.pipe.client, 0, b"", false),
            Err(Error::Done)
        );
        assert_eq!(s.client.send_body(&mut s.pipe.client, 0, b"", true), Ok(0));

        s.advance().ok();

        let mut recv_buf = vec![0; 100];

        let ev_headers = Event::Headers {
            list: req,
            has_body: true,
        };

        assert_eq!(s.poll_server(), Ok((stream, ev_headers)));

        assert_eq!(s.poll_server(), Ok((stream, Event::Data)));
        assert_eq!(s.recv_body_server(stream, &mut recv_buf), Err(Error::Done));

        assert_eq!(s.poll_server(), Ok((stream, Event::Finished)));
        assert_eq!(s.poll_server(), Err(Error::Done));

        let resp = s.send_response(stream, false).unwrap();

        assert_eq!(
            s.server.send_body(&mut s.pipe.server, 0, b"", false),
            Err(Error::Done)
        );
        assert_eq!(s.server.send_body(&mut s.pipe.server, 0, b"", true), Ok(0));

        s.advance().ok();

        let ev_headers = Event::Headers {
            list: resp,
            has_body: true,
        };

        assert_eq!(s.poll_client(), Ok((stream, ev_headers)));

        assert_eq!(s.poll_client(), Ok((stream, Event::Data)));
        assert_eq!(s.recv_body_client(stream, &mut recv_buf), Err(Error::Done));

        assert_eq!(s.poll_client(), Ok((stream, Event::Finished)));
        assert_eq!(s.poll_client(), Err(Error::Done));
    }
/// Test handling of 0-length DATA writes with and without fin.
Test handling of 0-length DATA writes with and without fin.
Test handling of 0 - length DATA writes with and without fin .
fn zero_length_data() {
        let mut s = Session::default().unwrap();
        s.handshake().unwrap();
        let (stream, req) = s.send_request(false).unwrap();
        assert_eq!(
            s.client.send_body(&mut s.pipe.client, 0, b"", false),
            Err(Error::Done)
        );
        assert_eq!(s.client.send_body(&mut s.pipe.client, 0, b"", true), Ok(0));
        s.advance().ok();
        let mut recv_buf = vec![0; 100];
        let ev_headers = Event::Headers {
            list: req,
            has_body: true,
        };
        assert_eq!(s.poll_server(), Ok((stream, ev_headers)));
        assert_eq!(s.poll_server(), Ok((stream, Event::Data)));
        assert_eq!(s.recv_body_server(stream, &mut recv_buf), Err(Error::Done));
        assert_eq!(s.poll_server(), Ok((stream, Event::Finished)));
        assert_eq!(s.poll_server(), Err(Error::Done));
        let resp = s.send_response(stream, false).unwrap();
        assert_eq!(
            s.server.send_body(&mut s.pipe.server, 0, b"", false),
            Err(Error::Done)
        );
        assert_eq!(s.server.send_body(&mut s.pipe.server, 0, b"", true), Ok(0));
        s.advance().ok();
        let ev_headers = Event::Headers {
            list: resp,
            has_body: true,
        };
        assert_eq!(s.poll_client(), Ok((stream, ev_headers)));
        assert_eq!(s.poll_client(), Ok((stream, Event::Data)));
        assert_eq!(s.recv_body_client(stream, &mut recv_buf), Err(Error::Done));
        assert_eq!(s.poll_client(), Ok((stream, Event::Finished)));
        assert_eq!(s.poll_client(), Err(Error::Done));
    }
fn zero_length_data ( ) { let mut s = Session :: default ( ) . unwrap ( ) ; s . handshake ( ) . unwrap ( ) ; let ( stream , req ) = s . send_request ( false ) . unwrap ( ) ; assert_eq ! ( s client send_body ( mut s pipe client 0 b" " false ) Err ( Error Done ) ) ; assert_eq ! ( s client send_body ( mut s pipe client 0 b" " true ) Ok ( 0 ) ) ; s . advance ( ) . ok ( ) ; let mut recv_buf = vec ! [ 0 100 ] ; let ev_headers = Event :: Headers { list : req , has_body : true , } ; assert_eq ! ( s poll_server ( ) Ok ( ( stream ev_headers ) ) ) ; assert_eq ! ( s poll_server ( ) Ok ( ( stream Event Data ) ) ) ; assert_eq ! ( s recv_body_server ( stream mut recv_buf ) Err ( Error Done ) ) ; assert_eq ! ( s poll_server ( ) Ok ( ( stream Event Finished ) ) ) ; assert_eq ! ( s poll_server ( ) Err ( Error Done ) ) ; let resp = s . send_response ( stream , false ) . unwrap ( ) ; assert_eq ! ( s server send_body ( mut s pipe server 0 b" " false ) Err ( Error Done ) ) ; assert_eq ! ( s server send_body ( mut s pipe server 0 b" " true ) Ok ( 0 ) ) ; s . advance ( ) . ok ( ) ; let ev_headers = Event :: Headers { list : resp , has_body : true , } ; assert_eq ! ( s poll_client ( ) Ok ( ( stream ev_headers ) ) ) ; assert_eq ! ( s poll_client ( ) Ok ( ( stream Event Data ) ) ) ; assert_eq ! ( s recv_body_client ( stream mut recv_buf ) Err ( Error Done ) ) ; assert_eq ! ( s poll_client ( ) Ok ( ( stream Event Finished ) ) ) ; assert_eq ! ( s poll_client ( ) Err ( Error Done ) ) ; }
Test handling of 0-length DATA writes with and without fin.
Test handling of 0 - length DATA writes with and without fin .