Example usage for android.net Proxy equals

List of usage examples for android.net Proxy equals

Introduction

In this page you can find the example usage for android.net Proxy equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:android.net.Proxy.java

/**
 * Returns the preferred proxy to be used by clients. This is a wrapper
 * around {@link android.net.Proxy#getHost()}.
 *
 * @param context the context which will be passed to
 * {@link android.net.Proxy#getHost()}/*  www .  ja va2  s . c  om*/
 * @param url the target URL for the request
 * @note Calling this method requires permission
 * android.permission.ACCESS_NETWORK_STATE
 * @return The preferred proxy to be used by clients, or null if there
 * is no proxy.
 * {@hide}
 */
public static final HttpHost getPreferredHttpHost(Context context, String url) {
    java.net.Proxy prefProxy = getProxy(context, url);
    if (prefProxy.equals(java.net.Proxy.NO_PROXY)) {
        return null;
    } else {
        InetSocketAddress sa = (InetSocketAddress) prefProxy.address();
        return new HttpHost(sa.getHostName(), sa.getPort(), "http");
    }
}