Tabnine Logo
Response.handshake
Code IndexAdd Tabnine to your IDE (free)

How to use
handshake
method
in
okhttp3.Response

Best Java code snippets using okhttp3.Response.handshake (Showing top 20 results out of 315)

origin: square/okhttp

@Override protected Handshake handshake() {
 return delegate.response.handshake();
}
origin: square/okhttp

public void run() throws Exception {
 Request request = new Request.Builder()
   .url("https://publicobject.com/helloworld.txt")
   .build();
 try (Response response = client.newCall(request).execute()) {
  if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
  System.out.println(response.handshake().cipherSuite());
  System.out.println(response.body().string());
 }
}
origin: square/okhttp

@Override public void onResponse(Call call, Response response) {
 synchronized (lock) {
  this.response = response;
  this.handshake = response.handshake();
  this.url = response.request().url().url();
  lock.notifyAll();
 }
}
origin: square/okhttp

public void run() throws Exception {
 Request request = new Request.Builder()
   .url("https://publicobject.com/robots.txt")
   .build();
 try (Response response = client.newCall(request).execute()) {
  if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
  for (Certificate certificate : response.handshake().peerCertificates()) {
   System.out.println(CertificatePinner.pin(certificate));
  }
 }
}
origin: square/okhttp

Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = HttpHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
 this.sentRequestMillis = response.sentRequestAtMillis();
 this.receivedResponseMillis = response.receivedResponseAtMillis();
}
origin: square/okhttp

 private static void sendRequest(OkHttpClient client, String url) {
  System.out.printf("%-40s ", url);
  System.out.flush();

  System.out.println(Platform.get());

  Request request = new Request.Builder().url(url).build();

  try (Response response = client.newCall(request).execute()) {
   Handshake handshake = response.handshake();
   System.out.println(handshake.tlsVersion()
     + " "
     + handshake.cipherSuite()
     + " "
     + response.protocol()
     + " "
     + response.code
     + " "
     + response.body.bytes().length
     + "b");
  } catch (IOException ioe) {
   System.out.println(ioe.toString());
  }
 }
}
origin: com.squareup.okhttp3/okhttp

Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = HttpHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
 this.sentRequestMillis = response.sentRequestAtMillis();
 this.receivedResponseMillis = response.receivedResponseAtMillis();
}
origin: square/okhttp

final ResponseBody body = response.body();
if (response.request().isHttps()) {
 final Handshake handshake = response.handshake();
 return new SecureCacheResponse() {
  @Override
origin: apollographql/apollo-android

ResponseHeaderRecord(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = HttpHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
 this.sentRequestMillis = response.sentRequestAtMillis();
 this.receivedResponseMillis = response.receivedResponseAtMillis();
}
origin: square/okhttp

public void run() throws Exception {
 String localhost = InetAddress.getByName("localhost").getCanonicalHostName();
 HeldCertificate localhostCertificate = new HeldCertificate.Builder()
   .addSubjectAlternativeName(localhost)
   .build();
 HandshakeCertificates serverCertificates = new HandshakeCertificates.Builder()
   .heldCertificate(localhostCertificate)
   .build();
 MockWebServer server = new MockWebServer();
 server.useHttps(serverCertificates.sslSocketFactory(), false);
 server.enqueue(new MockResponse());
 HandshakeCertificates clientCertificates = new HandshakeCertificates.Builder()
   .addTrustedCertificate(localhostCertificate.certificate())
   .build();
 OkHttpClient client = new OkHttpClient.Builder()
   .sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager())
   .build();
 Call call = client.newCall(new Request.Builder()
   .url(server.url("/"))
   .build());
 Response response = call.execute();
 System.out.println(response.handshake().tlsVersion());
}
origin: apache/nifi

/**
 * Returns a Map of flowfile attributes from the response http headers. Multivalue headers are naively converted to comma separated strings.
 */
private Map<String, String> convertAttributesFromHeaders(URL url, Response responseHttp){
  // create a new hashmap to store the values from the connection
  Map<String, String> map = new HashMap<>();
  responseHttp.headers().names().forEach( (key) -> {
      if (key == null) {
        return;
      }
      List<String> values = responseHttp.headers().values(key);
      // we ignore any headers with no actual values (rare)
      if (values == null || values.isEmpty()) {
        return;
      }
      // create a comma separated string from the values, this is stored in the map
      String value = csv(values);
      // put the csv into the map
      map.put(key, value);
  });
  if (responseHttp.request().isHttps()) {
    Principal principal = responseHttp.handshake().peerPrincipal();
    if (principal != null) {
      map.put(REMOTE_DN, principal.getName());
    }
  }
  return map;
}
origin: square/okhttp

if (request.isHttps() && cacheResponse.handshake() == null) {
 return new CacheStrategy(request, null);
origin: com.squareup.okhttp3/okhttp

if (request.isHttps() && cacheResponse.handshake() == null) {
 return new CacheStrategy(request, null);
origin: com.squareup.okhttp3/okhttp-urlconnection

@Override public void onResponse(Call call, Response response) {
 synchronized (lock) {
  this.response = response;
  this.handshake = response.handshake();
  this.url = response.request().url().url();
  lock.notifyAll();
 }
}
origin: huxq17/SwipeCardsView

public Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = OkHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
}
origin: duzechao/OKHttpUtils

public Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = OkHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
}
origin: huxq17/tractor

public Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = OkHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
}
origin: com.github.ljun20160606/okhttp

Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = HttpHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
 this.sentRequestMillis = response.sentRequestAtMillis();
 this.receivedResponseMillis = response.receivedResponseAtMillis();
}
origin: apache/servicemix-bundles

Entry(Response response) {
 this.url = response.request().url().toString();
 this.varyHeaders = HttpHeaders.varyHeaders(response);
 this.requestMethod = response.request().method();
 this.protocol = response.protocol();
 this.code = response.code();
 this.message = response.message();
 this.responseHeaders = response.headers();
 this.handshake = response.handshake();
 this.sentRequestMillis = response.sentRequestAtMillis();
 this.receivedResponseMillis = response.receivedResponseAtMillis();
}
origin: org.springframework.cloud/spring-cloud-netflix-ribbon

public OkHttpStatusCodeException(String serviceId, Response response, ResponseBody responseBody, URI uri) {
  super(serviceId, response.code(), response, uri);
  this.response = new Response.Builder().code(response.code()).message(response.message()).protocol(response.protocol())
      .request(response.request()).headers(response.headers()).handshake(response.handshake())
      .cacheResponse(response.cacheResponse()).networkResponse(response.networkResponse())
      .priorResponse(response.priorResponse()).sentRequestAtMillis(response.sentRequestAtMillis())
      .body(responseBody).build();
}
okhttp3Responsehandshake

Javadoc

Returns the TLS handshake of the connection that carried this response, or null if the response was received without TLS.

Popular methods of Response

  • body
    Returns a non-null value if this response was passed to Callback#onResponse or returned from Call#ex
  • code
    Returns the HTTP status code.
  • isSuccessful
    Returns true if the code is in [200..300), which means the request was successfully received, unders
  • headers
  • request
    The wire-level request that initiated this HTTP response. This is not necessarily the same request i
  • newBuilder
  • message
    Returns the HTTP status message.
  • header
  • close
    Closes the response body. Equivalent to body().close().It is an error to close a response that is no
  • protocol
    Returns the HTTP protocol, such as Protocol#HTTP_1_1 or Protocol#HTTP_1_0.
  • networkResponse
    Returns the raw response received from the network. Will be null if this response didn't use the net
  • cacheResponse
    Returns the raw response received from the cache. Will be null if this response didn't use the cache
  • networkResponse,
  • cacheResponse,
  • toString,
  • priorResponse,
  • sentRequestAtMillis,
  • cacheControl,
  • challenges,
  • peekBody,
  • receivedResponseAtMillis

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now