言語

Proxy.CreateHttpProxy Method

Definition

Constructs an HTTP proxy.

[Android.Runtime.Register("createHttpProxy", "(ILjava/lang/String;ILjava/util/concurrent/Executor;Landroid/net/http/Proxy$HttpConnectCallback;)Landroid/net/http/Proxy;", "", ApiSince=37)]
public static Android.Net.Http.Proxy CreateHttpProxy(int scheme, string host, int port, Java.Util.Concurrent.IExecutor executor, Android.Net.Http.Proxy.IHttpConnectCallback callback);
[<Android.Runtime.Register("createHttpProxy", "(ILjava/lang/String;ILjava/util/concurrent/Executor;Landroid/net/http/Proxy$HttpConnectCallback;)Landroid/net/http/Proxy;", "", ApiSince=37)>]
static member CreateHttpProxy : int * string * int * Java.Util.Concurrent.IExecutor * Android.Net.Http.Proxy.IHttpConnectCallback -> Android.Net.Http.Proxy

Parameters

scheme
Int32
host
String

Non-empty host that, alongside scheme and port, identifies this proxy. This value cannot be null.

port
Int32

Port that, alongside scheme and host, identifies this proxy. Its value must be within [0, 65535]. Value is between 0 and 65535 inclusive

executor
IExecutor

Executor where callback will be invoked. This value cannot be null.

callback
Proxy.IHttpConnectCallback

Callback that allows interacting with the HTTP CONNECT request, and its response, that HttpEngine sends to establish tunnels through the proxy. This value cannot be null.

Returns

Attributes

Remarks

Constructs an HTTP proxy.

When sending HTTP requests via an HTTP proxy, whether callback is called, or not, depends on the URI scheme of the destination: For destinations with an https URI scheme, HttpEngine establishes a tunnel through the proxy. The tunnel is established via an HTTP CONNECT request. In this case {code callback} will be called to control the HTTP CONNECT request used to establish the tunnel; For destinations with an http URI scheme, HttpEngine sends an HTTP request, containing the entire URI of the destination, to the proxy. In this case callback will not be called

Android reference for android.net.http.Proxy.createHttpProxy.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to