message: client: Close connection when stream receives last data
  Change logic to send packets generated from close (i.e. the one containing
  ConnectionClose frame.)
  Use event API instead of get_recvable_streams()
  Use \r in GET string.
diff: use neqo_common::now;
  use neqo_crypto::init_db;
  use neqo_transport::frame::StreamType;
  -use neqo_transport::{Connection, Datagram, State};
  +use neqo_transport::{Connection, ConnectionEvent, Datagram, State};
  use std::collections::HashSet;
  use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs, UdpSocket};
  use std::path::PathBuf;
  @@ -89,13 +89,16 @@ fn process_loop(
  if let State::Closed(..) = client.state() {
  return client.state().clone();
  }
  - if !handler.handle(client) {
  - return client.state().clone();
  - }
  +
  + let exiting = !handler.handle(client);
  let (out_dgrams, _timer) = client.process_output(now());
  emit_packets(&socket, &out_dgrams);
  + if exiting {
  + return client.state().clone();
  + }
  +
  let sz = socket.recv(&mut buf[..]).expect("UDP error");
  if sz == buf.len() {
  eprintln!("Received more than {} bytes", buf.len());
  @@ -129,18 +132,15 @@ struct PostConnectHandler {
  // This is a bit fancier than actually needed.
  impl Handler for PostConnectHandler {
  fn handle(&mut self, client: &mut Connection) -> bool {
  - let iter = client.get_recvable_streams();
  let mut data = vec![0; 4000];
  - let mut streams = Vec::new();
  - for (stream_id, _stream) in iter {
  + for event in client.events() {
  + match event {
  + ConnectionEvent::RecvStreamReadable { stream_id } => {
  if !self.streams.contains(&stream_id) {
  println!("Data on unexpected stream: {}", stream_id);
  return false;
  }
  - streams.push(stream_id);
  - }
  - for stream_id in streams {
  let (_sz, fin) = client
  .stream_recv(stream_id, &mut data)
  .expect("Read should succeed");
  @@ -151,9 +151,20 @@ impl Handler for PostConnectHandler {
  );
  if fin {
  println!("<FIN[{}]>", stream_id);
  + client.close(0, "kthxbye!");
  + return false;
  }
  }
  - return true;
  + ConnectionEvent::SendStreamWritable { stream_id } => {
  + println!("stream {} writable", stream_id)
  + }
  + _ => {
  + println!("Unexpected event {:?}", event);
  + }
  + }
  + }
  +
  + true
  }
  }
  @@ -176,9 +187,7 @@ fn main() {
  process_loop(&local_addr, &remote_addr, &socket, &mut client, &mut h);
  let client_stream_id = client.stream_create(StreamType::BiDi).unwrap();
  - let req: String = "GET /10\n
  -"
  - .to_string();
  + let req: String = "GET /10\r\n".to_string();
  client
  .stream_send(client_stream_id, req.as_bytes())
  .unwrap();
  