Class ProxyHandler


  • public class ProxyHandler
    extends java.lang.Object
    • Constructor Detail

      • ProxyHandler

        public ProxyHandler()
      • ProxyHandler

        public ProxyHandler​(ProxyType proxyType,
                            java.lang.String host,
                            int port)
      • ProxyHandler

        public ProxyHandler​(ProxyType proxyType,
                            java.lang.String host,
                            int port,
                            @Nullable
                            java.lang.String username,
                            @Nullable
                            java.lang.String password)
    • Method Detail

      • setProxy

        public void setProxy​(ProxyType type,
                             java.lang.String host,
                             int port)
        Set the proxy to use.
        Parameters:
        type - The type of the proxy
        host - The host of the proxy
        port - The port of the proxy
      • unsetProxy

        public void unsetProxy()
        Unset the proxy.
      • isProxySet

        public boolean isProxySet()
        Returns:
        If the proxy is set
      • getProxyType

        @Nullable
        public ProxyType getProxyType()
        Returns:
        The type of the proxy
      • setProxyType

        public void setProxyType​(@Nonnull
                                 ProxyType type)
        Set the type of the proxy.
        Parameters:
        type - The type of the proxy
      • getHost

        @Nullable
        public java.lang.String getHost()
        Returns:
        The proxy host
      • setHost

        public void setHost​(@Nonnull
                            java.lang.String host)
        Set the proxy host.
        Parameters:
        host - The proxy host
      • getPort

        public int getPort()
        Returns:
        The proxy port
      • setPort

        public void setPort​(int port)
        Set the proxy port.
        Parameters:
        port - The proxy port
      • isAuthenticationSet

        public boolean isAuthenticationSet()
        Returns:
        If the authentication is set
      • getUsername

        @Nullable
        public java.lang.String getUsername()
        Returns:
        The username for the proxy
      • setUsername

        public void setUsername​(@Nullable
                                java.lang.String username)
        Set the username for the proxy.
        Parameters:
        username - The username for the proxy
      • getPassword

        @Nullable
        public java.lang.String getPassword()
        Returns:
        The password for the proxy
      • setPassword

        public void setPassword​(@Nullable
                                java.lang.String password)
        Set the password for the proxy.
        Parameters:
        password - The password for the proxy
      • getProxySelector

        public SingleProxySelector getProxySelector()
        Returns:
        The SingleProxySelector for this proxy
        Throws:
        java.lang.IllegalStateException - If the proxy is not set
      • getProxyAuthenticator

        public SingleProxyAuthenticator getProxyAuthenticator()
        Returns:
        The SingleProxyAuthenticator for this proxy
        Throws:
        java.lang.IllegalStateException - If the proxy or the username/password is not set
      • toJavaProxy

        public java.net.Proxy toJavaProxy()
        Create a Proxy object from this proxy.
        The Proxy might not support all proxy types.
        Returns:
        The created Proxy object