@Override public void connect() throws IOException { if (executed) return; Call call = buildCall(); executed = true; call.enqueue(this); synchronized (lock) { try { while (connectPending && response == null && callFailure == null) { lock.wait(); // Wait 'til the network interceptor is reached or the call fails. } if (callFailure != null) { throw propagate(callFailure); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Retain interrupted status. throw new InterruptedIOException(); } } }
Call call = buildCall(); networkInterceptor.proceed();
@Override public OutputStream getOutputStream() throws IOException { OutputStreamRequestBody requestBody = (OutputStreamRequestBody) buildCall().request().body(); if (requestBody == null) { throw new ProtocolException("method does not support a request body: " + method); } // If this request needs to stream bytes to the server, build a physical connection immediately // and start streaming those bytes over that connection. if (requestBody instanceof StreamedRequestBody) { connect(); networkInterceptor.proceed(); } if (requestBody.isClosed()) { throw new ProtocolException("cannot write request body after response has been read"); } return requestBody.outputStream(); }
@Override public void connect() throws IOException { if (executed) return; Call call = buildCall(); executed = true; call.enqueue(this); synchronized (lock) { try { while (connectPending && response == null && callFailure == null) { lock.wait(); // Wait 'til the network interceptor is reached or the call fails. } if (callFailure != null) { throw propagate(callFailure); } } catch (InterruptedException e) { throw new InterruptedIOException(); } } }
@Override public void connect() throws IOException { if (executed) return; Call call = buildCall(); executed = true; call.enqueue(this); synchronized (lock) { try { while (connectPending && response == null && callFailure == null) { lock.wait(); // Wait 'til the network interceptor is reached or the call fails. } if (callFailure != null) { throw propagate(callFailure); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Retain interrupted status. throw new InterruptedIOException(); } } }
@Override public void connect() throws IOException { if (executed) return; Call call = buildCall(); executed = true; call.enqueue(this); synchronized (lock) { try { while (connectPending && response == null && callFailure == null) { lock.wait(); // Wait 'til the network interceptor is reached or the call fails. } if (callFailure != null) { throw propagate(callFailure); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Retain interrupted status. throw new InterruptedIOException(); } } }
Call call = buildCall(); networkInterceptor.proceed();
Call call = buildCall(); networkInterceptor.proceed();
Call call = buildCall(); networkInterceptor.proceed();
@Override public OutputStream getOutputStream() throws IOException { OutputStreamRequestBody requestBody = (OutputStreamRequestBody) buildCall().request().body(); if (requestBody == null) { throw new ProtocolException("method does not support a request body: " + method); } // If this request needs to stream bytes to the server, build a physical connection immediately // and start streaming those bytes over that connection. if (requestBody instanceof StreamedRequestBody) { connect(); networkInterceptor.proceed(); } if (requestBody.isClosed()) { throw new ProtocolException("cannot write request body after response has been read"); } return requestBody.outputStream(); }
@Override public OutputStream getOutputStream() throws IOException { OutputStreamRequestBody requestBody = (OutputStreamRequestBody) buildCall().request().body(); if (requestBody == null) { throw new ProtocolException("method does not support a request body: " + method); } // If this request needs to stream bytes to the server, build a physical connection immediately // and start streaming those bytes over that connection. if (requestBody instanceof StreamedRequestBody) { connect(); networkInterceptor.proceed(); } if (requestBody.isClosed()) { throw new ProtocolException("cannot write request body after response has been read"); } return requestBody.outputStream(); }
@Override public OutputStream getOutputStream() throws IOException { OutputStreamRequestBody requestBody = (OutputStreamRequestBody) buildCall().request().body(); if (requestBody == null) { throw new ProtocolException("method does not support a request body: " + method); } // If this request needs to stream bytes to the server, build a physical connection immediately // and start streaming those bytes over that connection. if (requestBody instanceof StreamedRequestBody) { connect(); networkInterceptor.proceed(); } if (requestBody.isClosed()) { throw new ProtocolException("cannot write request body after response has been read"); } return requestBody.outputStream(); }