okhttp3.internal.platform.Platform.getSelectedProtocol()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中okhttp3.internal.platform.Platform.getSelectedProtocol()方法的一些代码示例,展示了Platform.getSelectedProtocol()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getSelectedProtocol()方法的具体详情如下:
包路径:okhttp3.internal.platform.Platform
类名称:Platform
方法名:getSelectedProtocol

Platform.getSelectedProtocol介绍

[英]Returns the negotiated protocol, or null if no protocol was negotiated.
[中]返回协商的协议,如果没有协商协议,则返回null。

代码示例

代码示例来源:origin: square/okhttp

@Override public @Nullable String getSelectedProtocol(SSLSocket sslSocket) {
 if (Conscrypt.isConscrypt(sslSocket)) {
  return Conscrypt.getApplicationProtocol(sslSocket);
 } else {
  return super.getSelectedProtocol(sslSocket);
 }
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

@Override public @Nullable String getSelectedProtocol(SSLSocket sslSocket) {
 if (Conscrypt.isConscrypt(sslSocket)) {
  return Conscrypt.getApplicationProtocol(sslSocket);
 } else {
  return super.getSelectedProtocol(sslSocket);
 }
}

代码示例来源:origin: square/okhttp

String protocolString = Platform.get().getSelectedProtocol(sslSocket);
protocol = protocolString != null ? Protocol.get(protocolString) : Protocol.HTTP_1_1;

代码示例来源:origin: square/okhttp

? Platform.get().getSelectedProtocol(sslSocket)
  : null;
socket = sslSocket;

代码示例来源:origin: com.squareup.okhttp3/okhttp

? Platform.get().getSelectedProtocol(sslSocket)
  : null;
socket = sslSocket;

代码示例来源:origin: apache/servicemix-bundles

@Override public @Nullable String getSelectedProtocol(SSLSocket sslSocket) {
 if (Conscrypt.isConscrypt(sslSocket)) {
  return Conscrypt.getApplicationProtocol(sslSocket);
 } else {
  return super.getSelectedProtocol(sslSocket);
 }
}

代码示例来源:origin: com.github.ljun20160606/mockwebserver

String protocolString = Platform.get().getSelectedProtocol(sslSocket);
protocol = protocolString != null ? Protocol.get(protocolString) : Protocol.HTTP_1_1;

代码示例来源:origin: com.github.ljun20160606/mockwebserver

private void run() throws Exception {
 ServerSocket serverSocket = new ServerSocket(8888);
 serverSocket.setReuseAddress(true);
 while (true) {
  Socket socket = null;
  try {
   socket = serverSocket.accept();
   SSLSocket sslSocket = doSsl(socket);
   String protocolString = Platform.get().getSelectedProtocol(sslSocket);
   Protocol protocol = protocolString != null ? Protocol.get(protocolString) : null;
   if (protocol != Protocol.HTTP_2) {
    throw new ProtocolException("Protocol " + protocol + " unsupported");
   }
   Http2Connection connection = new Http2Connection.Builder(false)
     .socket(sslSocket)
     .listener(this)
     .build();
   connection.start();
  } catch (IOException e) {
   logger.log(Level.INFO, "Http2Server connection failure: " + e);
   Util.closeQuietly(socket);
  } catch (Exception e) {
   logger.log(Level.WARNING, "Http2Server unexpected failure", e);
   Util.closeQuietly(socket);
  }
 }
}

代码示例来源:origin: com.github.ljun20160606/okhttp

? Platform.get().getSelectedProtocol(sslSocket)
  : null;
socket = sslSocket;

代码示例来源:origin: apache/servicemix-bundles

? Platform.get().getSelectedProtocol(sslSocket)
  : null;
socket = sslSocket;

相关文章