Class ClientUtil


  • public class ClientUtil
    extends java.lang.Object
    A utility class with convenience methods for clients using BrowserUp Proxy in embedded mode.
    • Constructor Detail

      • ClientUtil

        public ClientUtil()
    • Method Detail

      • createSeleniumProxy

        public static org.openqa.selenium.Proxy createSeleniumProxy​(BrowserUpProxy browserUpProxy)
        Creates a Selenium Proxy object from the BrowserUpProxy instance. The BrowserUpProxy must be started. Retrieves the address of the Proxy using getConnectableAddress().
        Parameters:
        browserUpProxy - started BrowserUpProxy instance to read connection information from
        Returns:
        a Selenium Proxy instance, configured to use the BrowserUpProxy instance as its proxy server
        Throws:
        java.lang.IllegalStateException - if the proxy has not been started.
      • createSeleniumProxy

        public static org.openqa.selenium.Proxy createSeleniumProxy​(BrowserUpProxy browserUpProxy,
                                                                    java.net.InetAddress connectableAddress)
        Creates a Selenium Proxy object from the BrowserUpProxy instance, using the specified connectableAddress as the Selenium Proxy object's proxy address. Determines the port using BrowserUpProxy.getPort(). The BrowserUpProxy must be started.
        Parameters:
        browserUpProxy - started BrowserUpProxy instance to read the port from
        connectableAddress - the network address the Selenium Proxy will use to reach this BrowserUpProxy instance
        Returns:
        a Selenium Proxy instance, configured to use the BrowserUpProxy instance as its proxy server
        Throws:
        java.lang.IllegalStateException - if the proxy has not been started.
      • createSeleniumProxy

        public static org.openqa.selenium.Proxy createSeleniumProxy​(java.net.InetSocketAddress connectableAddressAndPort)
        Creates a Selenium Proxy object using the specified connectableAddressAndPort as the HTTP proxy server.
        Parameters:
        connectableAddressAndPort - the network address (or hostname) and port the Selenium Proxy will use to reach its proxy server (the InetSocketAddress may be unresolved).
        Returns:
        a Selenium Proxy instance, configured to use the specified address and port as its proxy server
      • getConnectableAddress

        public static java.net.InetAddress getConnectableAddress()
        Attempts to retrieve a "connectable" address for this device that other devices on the network can use to connect to a local proxy. This is a "reasonable guess" that is suitable in many (but not all) common scenarios. TODO: define the algorithm used to discover a "connectable" local host
        Returns:
        a "reasonable guess" at an address that can be used by other machines on the network to reach this host