add socks4a:// and socks:// tests

This commit is contained in:
Keijia
2021-08-20 16:40:21 +03:00
committed by Martin Algesten
parent 12b49e59f4
commit 401d051bd1

View File

@@ -207,6 +207,28 @@ mod tests {
assert_eq!(proxy.proto, Proto::SOCKS5);
}
#[cfg(feature = "socks-proxy")]
#[test]
fn parse_proxy_socks4a_user_pass_server_port() {
let proxy = Proxy::new("socks4a://user:p@ssw0rd@localhost:9999").unwrap();
assert_eq!(proxy.user, Some(String::from("user")));
assert_eq!(proxy.password, Some(String::from("p@ssw0rd")));
assert_eq!(proxy.server, String::from("localhost"));
assert_eq!(proxy.port, 9999);
assert_eq!(proxy.proto, Proto::SOCKS5);
}
#[cfg(feature = "socks-proxy")]
#[test]
fn parse_proxy_socks_user_pass_server_port() {
let proxy = Proxy::new("socks://user:p@ssw0rd@localhost:9999").unwrap();
assert_eq!(proxy.user, Some(String::from("user")));
assert_eq!(proxy.password, Some(String::from("p@ssw0rd")));
assert_eq!(proxy.server, String::from("localhost"));
assert_eq!(proxy.port, 9999);
assert_eq!(proxy.proto, Proto::SOCKS5);
}
#[cfg(feature = "socks-proxy")]
#[test]
fn parse_proxy_socks5_user_pass_server_port() {