Class Socks5Proxy


public class Socks5Proxy extends ProxyConfiguration.Proxy

Client-side proxy configuration for SOCKS5, defined by RFC 1928.

Multiple authentication methods are supported via putAuthenticationFactory(Socks5.Authentication.Factory). By default only the NO AUTH authentication method is configured. The USERNAME/PASSWORD is available to applications but must be explicitly configured and added.

  • Constructor Details

    • Socks5Proxy

      public Socks5Proxy(String host, int port)

      Creates a new instance with the given SOCKS5 proxy host and port.

      Parameters:
      host - the SOCKS5 proxy host name
      port - the SOCKS5 proxy port
    • Socks5Proxy

      public Socks5Proxy(Origin.Address address, boolean secure)

      Creates a new instance with the given SOCKS5 proxy address.

      When secure=true the communication between the client and the proxy will be encrypted (using this proxy ProxyConfiguration.Proxy.getSslContextFactory() which typically defaults to that of HttpClient.

      Parameters:
      address - the SOCKS5 proxy address (host and port)
      secure - whether the communication between the client and the SOCKS5 proxy should be secure
  • Method Details

    • putAuthenticationFactory

      public Socks5.Authentication.Factory putAuthenticationFactory(Socks5.Authentication.Factory authenticationFactory)

      Provides this class with the given SOCKS5 authentication method.

      Parameters:
      authenticationFactory - the SOCKS5 authentication factory
      Returns:
      the previous authentication method of the same type, or null if there was none of that type already present
    • removeAuthenticationFactory

      public Socks5.Authentication.Factory removeAuthenticationFactory(byte method)

      Removes the authentication of the given method.

      Parameters:
      method - the authentication method to remove
    • newClientConnectionFactory

      public org.eclipse.jetty.io.ClientConnectionFactory newClientConnectionFactory(org.eclipse.jetty.io.ClientConnectionFactory connectionFactory)
      Specified by:
      newClientConnectionFactory in class ProxyConfiguration.Proxy
      Parameters:
      connectionFactory - the nested ClientConnectionFactory
      Returns:
      a new ClientConnectionFactory for this Proxy