diff --git a/src/proxy.rs b/src/proxy.rs index 471bd53..044dac0 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -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() {