Example usage for org.openqa.selenium Proxy getFtpProxy

List of usage examples for org.openqa.selenium Proxy getFtpProxy

Introduction

In this page you can find the example usage for org.openqa.selenium Proxy getFtpProxy.

Prototype

public String getFtpProxy() 

Source Link

Document

Gets the FTP proxy.

Usage

From source file:com.opera.core.systems.OperaProxy.java

License:Apache License

/**
 * Parse an instance of {@link Proxy}, merge and apply its configuration to the current Opera
 * instance./*from   w  w  w  .j  a v  a  2s  .  c o  m*/
 */
public void parse(Proxy proxy) {
    if (proxy.getProxyType() == Proxy.ProxyType.UNSPECIFIED) {
        return;
    }

    reset();

    switch (proxy.getProxyType()) {
    case DIRECT:
        if (!product.is(MOBILE)) {
            setEnabled(false);
        }
        setUsePAC(false);
        break;

    case MANUAL:
        if (!product.is(MOBILE)) {
            setEnabled(true);
        }
        setUsePAC(false);

        // TODO(andreastt): HTTPS proxy
        // TODO(andreastt): SOCKS proxy

        if (proxy.getHttpProxy() != null) {
            setHttpProxy(proxy.getHttpProxy());
        }
        if (proxy.getFtpProxy() != null) {
            setFtpProxy(proxy.getFtpProxy());
        }

        break;

    case PAC:
        if (!product.is(MOBILE)) {
            setEnabled(true);
        }
        setUsePAC(true);

        if (proxy.getProxyAutoconfigUrl() != null) {
            setAutoconfigUrl(proxy.getProxyAutoconfigUrl());
        }

        break;

    default:
        logger.warning("Unsupported proxy type: " + proxy.getProxyType());
    }
}