pub fn with<F: ServiceFactory<TcpStream>>(factory: F) -> TestServerRuntime {
        let (tx, rx) = mpsc::channel();

        // run server in separate thread
        thread::spawn(move || {
            let sys = System::new("scrappy-test-server");
            let tcp = net::TcpListener::bind("127.0.0.1:0").unwrap();
            let local_addr = tcp.local_addr().unwrap();

            Server::build()
                .listen("test", tcp, factory)?
                .workers(1)
                .disable_signals()
                .start();

            tx.send((System::current(), local_addr)).unwrap();
            sys.run()
        });

        let (system, addr) = rx.recv().unwrap();

        let host = format!("{}", addr.ip());
        let port = addr.port();

        TestServerRuntime {
            system,
            addr,
            host,
            port,
        }
    }
/// Start new test server with application factory
Start new test server with application factory
Start new test server with application factory
pub fn with<F: ServiceFactory<TcpStream>>(factory: F) -> TestServerRuntime {
        let (tx, rx) = mpsc::channel();
        // run server in separate thread
        thread::spawn(move || {
            let sys = System::new("scrappy-test-server");
            let tcp = net::TcpListener::bind("127.0.0.1:0").unwrap();
            let local_addr = tcp.local_addr().unwrap();
            Server::build()
                .listen("test", tcp, factory)?
                .workers(1)
                .disable_signals()
                .start();
            tx.send((System::current(), local_addr)).unwrap();
            sys.run()
        });
        let (system, addr) = rx.recv().unwrap();
        let host = format!("{}", addr.ip());
        let port = addr.port();
        TestServerRuntime {
            system,
            addr,
            host,
            port,
        }
    }
pub fn with < F : ServiceFactory < TcpStream > > ( factory : F ) -> TestServerRuntime { let ( tx , rx ) = mpsc :: channel ( ) ; // run server in separate thread thread :: spawn ( move | | { let sys = System :: new ( " " ) ; let tcp = net :: TcpListener :: bind ( " " ) . unwrap ( ) ; let local_addr = tcp . local_addr ( ) . unwrap ( ) ; Server :: build ( ) . listen ( " " , tcp , factory ) ? . workers ( 1 ) . disable_signals ( ) . start ( ) ; tx . send ( ( System :: current ( ) , local_addr ) ) . unwrap ( ) ; sys . run ( ) } ) ; let ( system , addr ) = rx . recv ( ) . unwrap ( ) ; let host = format ! ( " " addr ip ( ) ) ; let port = addr . port ( ) ; TestServerRuntime { system , addr , host , port , } }
Start new test server with application factory
Start new test server with application factory
factory
F