We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fca9e6e commit f65b5d0Copy full SHA for f65b5d0
library/std/src/net/tcp/tests.rs
@@ -46,6 +46,17 @@ fn connect_error() {
46
}
47
48
49
+#[test]
50
+fn connect_timeout_to_unreachable_address() {
51
+ let now = Instant::now();
52
+ match TcpStream::connect_timeout(&format!("1.1.1.1:9999").parse().unwrap(), Duration::MAX) {
53
+ Ok(..) => panic!("connected to an unreachable address, this is impossible"),
54
+ Err(e) => assert_eq!(e.kind(), ErrorKind::TimedOut),
55
+ }
56
+
57
+ assert!(now.elapsed() > Duration::from_secs(20));
58
+}
59
60
#[test]
61
fn connect_timeout_error() {
62
let socket_addr = next_test_ip4();
0 commit comments