File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -2044,22 +2044,20 @@ mod conn {
2044
2044
#[ tokio:: test]
2045
2045
async fn test_try_send_request ( ) {
2046
2046
use std:: future:: Future ;
2047
- let ( listener, addr) = setup_tk_test_server ( ) . await ;
2048
2047
let ( done_tx, done_rx) = tokio:: sync:: oneshot:: channel :: < ( ) > ( ) ;
2048
+ let ( io_srv, io_cli) = tokio_test:: io:: Builder :: new ( )
2049
+ . write ( b"GET / HTTP/1.1\r \n \r \n " )
2050
+ . read ( b"HTTP/1.1 200 OK\r \n content-length: 0\r \n \r \n " )
2051
+ . build_with_handle ( ) ;
2049
2052
2050
2053
tokio:: spawn ( async move {
2051
- let mut sock = listener. accept ( ) . await . unwrap ( ) . 0 ;
2052
- let mut buf = [ 0u8 ; 8192 ] ;
2053
- sock. read ( & mut buf) . await . expect ( "read 1" ) ;
2054
- sock. write_all ( b"HTTP/1.1 200 OK\r \n content-length: 0\r \n \r \n " )
2055
- . await
2056
- . expect ( "write 1" ) ;
2054
+ let _io = io_cli;
2057
2055
let _ = done_rx. await ;
2058
2056
} ) ;
2059
2057
2060
2058
// make polling fair by putting both in spawns
2061
2059
tokio:: spawn ( async move {
2062
- let io = tcp_connect ( & addr ) . await . expect ( "tcp connect" ) ;
2060
+ let io = TokioIo :: new ( io_srv ) ;
2063
2061
let ( mut client, mut conn) = conn:: http1:: Builder :: new ( )
2064
2062
. handshake :: < _ , Empty < Bytes > > ( io)
2065
2063
. await
You can’t perform that action at this time.
0 commit comments