You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dispatcher.rs
    path of file: ./repos/ntex/ntex/src/http/h1
    
    the code of the file until where you have to start completion: //! HTTP/1 protocol dispatcher
use std::{error, future, io, marker, pin::Pin, rc::Rc, task::Context, task::Poll};

use crate::io::{Decoded, Filter, Io, IoBoxed, IoStatusUpdate, RecvError};
use crate::service::{PipelineCall, Service};
use crate::time::Seconds;
use crate::util::{ready, Either};

use crate::http::body::{BodySize, MessageBody, ResponseBody};
use crate::http::error::{PayloadError, ResponseError};
use crate::http::message::{ConnectionType, CurrentIo};
use crate::http::{self, config::DispatcherConfig, request::Request, response::Response};

use super::control::{Control, ControlA
    
    async fn test_on_request() {
        let (client, server) = Io::create();
        client.remote_buffer_cap(1024);
        client.write("GET /test HTTP/1.0\r\n\r\n");

        let data = Rc::new(Cell::new(false));
        let data2 = data.clone();
        let config = ServiceConfig::new(
            Seconds(5).into(),
            Seconds(1),
            Seconds::ZERO,
            Millis(5_000),
            Config::server(),
        );
        let mut h1 = Dispatcher::<_, _, _, _>::new(
            nio::Io::new(server),
            Rc::new(DispatcherConfig::new(
                config,
                fn_service(|_| {
                    Box::pin(async { Ok::<_, io::Error>(Response::Ok().finish()) })
                }),
                fn_service(move |req: Control<_, _>| {
                    if let Control::NewRequest(_) = req {
                        data2.set(true);
                    }
                    async move { Ok::<_, std::convert::Infallible>(req.ack()) }
                }),
            )),
        );
        sleep(Millis(50)).await;
        let _ = lazy(|cx| Pin::new(&mut h1).poll(cx)).await;
        sleep(Millis(50)).await;

        client.local_buffer(|buf| assert_eq!(&buf[..15], b"HTTP/1.0 200 OK"));
        client.close().await;

        assert!(lazy(|cx| Pin::new(&mut h1).poll(cx)).await.is_ready());
        assert!(data.get());
    }