aboutsummaryrefslogtreecommitdiff
path: root/tests/tcp_into_std.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcp_into_std.rs')
-rw-r--r--tests/tcp_into_std.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/tcp_into_std.rs b/tests/tcp_into_std.rs
index a46aace..4bf24c1 100644
--- a/tests/tcp_into_std.rs
+++ b/tests/tcp_into_std.rs
@@ -10,10 +10,11 @@ use tokio::net::TcpStream;
#[tokio::test]
async fn tcp_into_std() -> Result<()> {
let mut data = [0u8; 12];
- let listener = TcpListener::bind("127.0.0.1:34254").await?;
+ let listener = TcpListener::bind("127.0.0.1:0").await?;
+ let addr = listener.local_addr().unwrap().to_string();
let handle = tokio::spawn(async {
- let stream: TcpStream = TcpStream::connect("127.0.0.1:34254").await.unwrap();
+ let stream: TcpStream = TcpStream::connect(addr).await.unwrap();
stream
});