Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Oct 9, 2023
1 parent 5bfad40 commit 1d38769
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ntex::http::{
use ntex::service::{fn_service, ServiceFactory};
use ntex::time::{sleep, Millis};
use ntex::{channel::oneshot, connect::openssl, io::IoBoxed, util::Bytes};
use ntex_h2::{client::Client, client::SimpleClient, frame::Reason};
use ntex_h2::{client, client::Client, client::SimpleClient, frame::Reason};

fn ssl_acceptor() -> SslAcceptor {
// load ssl keys
Expand Down Expand Up @@ -71,13 +71,20 @@ async fn connect(addr: net::SocketAddr) -> IoBoxed {
#[ntex::test]
async fn test_max_concurrent_streams() {
let srv = start_server();
let io = connect(srv.addr()).await;
let client = SimpleClient::new(
io,
ntex_h2::Config::client(),
Scheme::HTTP,
"localhost".into(),
);
let addr = srv.addr();
let client = client::Connector::new(fn_service(move |_| {
let addr = addr;
async move { Ok(connect(addr).await) }
}))
.scheme(Scheme::HTTP)
.connector(fn_service(move |_| {
let addr = addr;
async move { Ok(connect(addr).await) }
}))
.connect("localhost")
.await
.unwrap();

sleep(Millis(50)).await; // we need to get settings frame from server

let (stream, _recv_stream) = client
Expand Down

0 comments on commit 1d38769

Please sign in to comment.