Java 类com.squareup.okhttp.internal.Platform 实例源码

项目:boohee_v5.6    文件:RealConnection.java   
private void connectSocket(int connectTimeout, int readTimeout, int writeTimeout,
                           ConnectionSpecSelector connectionSpecSelector) throws IOException {
    this.rawSocket.setSoTimeout(readTimeout);
    try {
        Platform.get().connectSocket(this.rawSocket, this.route.getSocketAddress(),
                connectTimeout);
        this.source = Okio.buffer(Okio.source(this.rawSocket));
        this.sink = Okio.buffer(Okio.sink(this.rawSocket));
        if (this.route.getAddress().getSslSocketFactory() != null) {
            connectTls(readTimeout, writeTimeout, connectionSpecSelector);
        } else {
            this.protocol = Protocol.HTTP_1_1;
            this.socket = this.rawSocket;
        }
        if (this.protocol == Protocol.SPDY_3 || this.protocol == Protocol.HTTP_2) {
            this.socket.setSoTimeout(0);
            FramedConnection framedConnection = new Builder(true).socket(this.socket, this
                    .route.getAddress().url().host(), this.source, this.sink).protocol(this
                    .protocol).build();
            framedConnection.sendConnectionPreface();
            this.framedConnection = framedConnection;
        }
    } catch (ConnectException e) {
        throw new ConnectException("Failed to connect to " + this.route.getSocketAddress());
    }
}
项目:LoRaWAN-Smart-Parking    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:LoRaWAN-Smart-Parking    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:LoRaWAN-Smart-Parking    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:LoRaWAN-Smart-Parking    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:LoRaWAN-Smart-Parking    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:LoRaWAN-Smart-Parking    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:LoRaWAN-Smart-Parking    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:LoRaWAN-Smart-Parking    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:smart-mirror-app    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:smart-mirror-app    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:smart-mirror-app    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:smart-mirror-app    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:cordova-plugin-background-mode    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:cordova-plugin-background-mode    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:cordova-plugin-background-mode    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:cordova-plugin-background-mode    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:hustElectricity    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:multirotorstuff-vtx-calc    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:multirotorstuff-vtx-calc    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:multirotorstuff-vtx-calc    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:FMTech    文件:Request.java   
public final URI uri()
  throws IOException
{
  try
  {
    URI localURI1 = this.uri;
    if (localURI1 != null) {
      return localURI1;
    }
    Platform.get();
    URI localURI2 = Platform.toUriLenient(url());
    this.uri = localURI2;
    return localURI2;
  }
  catch (URISyntaxException localURISyntaxException)
  {
    throw new IOException(localURISyntaxException.getMessage());
  }
}
项目:CrossWalkAndroidStudio    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:android-discourse    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest) throws IOException {
    if (connected) {
        throw new IllegalStateException("already connected");
    }
    connected = true;
    socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
    Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
    socket.setSoTimeout(readTimeout);
    in = socket.getInputStream();
    out = socket.getOutputStream();

    if (route.address.sslSocketFactory != null) {
        upgradeToTls(tunnelRequest);
    }

    // Use MTU-sized buffers to send fewer packets.
    int mtu = Platform.get().getMtu(socket);
    if (mtu < 1024)
        mtu = 1024;
    if (mtu > 8192)
        mtu = 8192;
    in = new BufferedInputStream(in, mtu);
    out = new BufferedOutputStream(out, mtu);
}
项目:L.TileLayer.Cordova    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:wototoplayer    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:cordova-android-tv    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:Cordova-Locale-Plugin    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:Cordova-Locale-Plugin    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:Cordova-Locale-Plugin    文件:HttpURLConnectionImpl.java   
@Override public final void addRequestProperty(String field, String value) {
  if (connected) {
    throw new IllegalStateException("Cannot add request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (value == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(value, true /* append */);
  } else {
    rawRequestHeaders.add(field, value);
  }
}
项目:Cordova-Locale-Plugin    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:pubnub-rpi-smart-parking    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:gwt-material-phonegap    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:IoTgo_Android_App    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:NgFileExplorer    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:MinWageCalc    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:DemoArduinoAndroidCordovaBT    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}
项目:posjs2    文件:HttpEngine.java   
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
项目:krakn    文件:Connection.java   
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
    throws IOException {
  if (connected) throw new IllegalStateException("already connected");

  socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
  Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
  socket.setSoTimeout(readTimeout);
  in = socket.getInputStream();
  out = socket.getOutputStream();

  if (route.address.sslSocketFactory != null) {
    upgradeToTls(tunnelRequest);
  } else {
    streamWrapper();
  }
  connected = true;
}
项目:posjs2    文件:HttpURLConnectionImpl.java   
@Override public final void setRequestProperty(String field, String newValue) {
  if (connected) {
    throw new IllegalStateException("Cannot set request property after connection is made");
  }
  if (field == null) {
    throw new NullPointerException("field == null");
  }
  if (newValue == null) {
    // Silently ignore null header values for backwards compatibility with older
    // android versions as well as with other URLConnection implementations.
    //
    // Some implementations send a malformed HTTP header when faced with
    // such requests, we respect the spec and ignore the header.
    Platform.get().logW("Ignoring header " + field + " because its value was null.");
    return;
  }

  if ("X-Android-Transports".equals(field)) {
    setTransports(newValue, false /* append */);
  } else {
    rawRequestHeaders.set(field, newValue);
  }
}