Did you know ... Search Documentation:
Predicate try_proxy/4
 try_proxy(+Proxy, +TargetAddress, -Socket, -StreamPair) is semidet[multifile, library(socket)]
Attempt a socket-level connection via the given proxy to TargetAddress. The Proxy argument must match the output argument of proxy_for_url/3. The predicate tcp_connect/3 (and http_open/3 from the library(http/http_open)) collect the results of failed proxies and raise an exception no proxy is capable of realizing the connection.

The default implementation recognises the values for Proxy described below. The library(http/http_proxy) adds proxy(Host,Port) which allows for HTTP proxies using the CONNECT method.

Do not use any proxy
socks(Host, Port)
Use a SOCKS5 proxy
 socket:try_proxy(+Proxy, +Address, -Socket, -StreamPair)[multifile, library(http/http_proxy)]
Connection is via an HTTP proxy for socket: Use HTTP CONNECT. Note that most proxies will only support this for connecting on port 443
Proxy- is of the form proxy(Host, Port)
- proxy_error(Message) if the proxy connection is not successful.