add socks4a:// and socks:// tests

This commit is contained in:
Keijia authored and Martin Algesten committed 2021-08-23 20:46:44 +02:00
1 parent 12b49e59f4
commit 401d051bd1
1 file changed
+22
+22
View File
@@ -207,6 +207,28 @@ mod tests {
assert_eq!(proxy.proto, Proto::SOCKS5); 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")] #[cfg(feature = "socks-proxy")]
#[test] #[test]
fn parse_proxy_socks5_user_pass_server_port() { fn parse_proxy_socks5_user_pass_server_port() {