Class SOCKSClientConfig

java.lang.Object
org.bluezoo.gumdrop.socks.client.SOCKSClientConfig

public final class SOCKSClientConfig extends Object
Configuration for a SOCKS client connection.

Holds the SOCKS protocol version preference, optional authentication credentials, and timeout settings.

Author:
Chris Burdess
See Also:
  • Constructor Details

    • SOCKSClientConfig

      public SOCKSClientConfig()
      Creates a config with default settings (SOCKS5, no auth).
    • SOCKSClientConfig

      public SOCKSClientConfig(String username, String password)
      Creates a config with username/password authentication.
      Parameters:
      username - the username
      password - the password
  • Method Details

    • getVersion

      public SOCKSClientConfig.Version getVersion()
      Returns the SOCKS version preference.
      Returns:
      the version preference
    • setVersion

      public SOCKSClientConfig setVersion(SOCKSClientConfig.Version version)
      Sets the SOCKS version preference.
      Parameters:
      version - the version preference
      Returns:
      this config for chaining
    • getUsername

      public String getUsername()
      Returns the authentication username. Used for SOCKS5 username/password authentication (RFC 1929 §2).
      Returns:
      the username, or null if no authentication
    • setUsername

      public SOCKSClientConfig setUsername(String username)
      Sets the authentication username. Used for SOCKS5 username/password authentication (RFC 1929 §2).
      Parameters:
      username - the username
      Returns:
      this config for chaining
    • getPassword

      public String getPassword()
      Returns the authentication password. Used for SOCKS5 username/password authentication (RFC 1929 §2).
      Returns:
      the password, or null if no authentication
    • setPassword

      public SOCKSClientConfig setPassword(String password)
      Sets the authentication password. Used for SOCKS5 username/password authentication (RFC 1929 §2).
      Parameters:
      password - the password
      Returns:
      this config for chaining
    • getHandshakeTimeoutMs

      public long getHandshakeTimeoutMs()
      Returns the handshake timeout in milliseconds.
      Returns:
      the timeout
    • setHandshakeTimeoutMs

      public SOCKSClientConfig setHandshakeTimeoutMs(long timeoutMs)
      Sets the handshake timeout for the SOCKS negotiation.
      Parameters:
      timeoutMs - the timeout in milliseconds
      Returns:
      this config for chaining
    • hasCredentials

      public boolean hasCredentials()
      Returns whether credentials are configured.
      Returns:
      true if both username and password are non-null