public class Platform extends Object
Supported on Android 2.3+. Supported on OpenJDK 7+
Supported on Android 2.3+.
Supported on Android 4.0+.
Supported on Android 5.0+. The APIs were present in Android 4.4, but that implementation was unstable. Supported on OpenJDK 7 and 8 (via the JettyALPN-boot library). Supported on OpenJDK 9 via SSLParameters and SSLSocket features.
Supported on Android 2.3+ and OpenJDK 7+. There are no public APIs to recover the trust
manager that was used to create an SSLSocketFactory.
Supported on Android 6.0+ via NetworkSecurityPolicy.
| Constructor and Description |
|---|
Platform() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterHandshake(SSLSocket sslSocket)
Called after the TLS handshake to release resources allocated by
configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List<okhttp3.Protocol>). |
static List<String> |
alpnProtocolNames(List<Protocol> protocols) |
CertificateChainCleaner |
buildCertificateChainCleaner(X509TrustManager trustManager) |
void |
configureTlsExtensions(SSLSocket sslSocket,
String hostname,
List<Protocol> protocols)
Configure TLS extensions on
sslSocket for route. |
void |
connectSocket(Socket socket,
InetSocketAddress address,
int connectTimeout) |
static Platform |
get() |
String |
getPrefix()
Prefix used on custom headers.
|
String |
getSelectedProtocol(SSLSocket socket)
Returns the negotiated protocol, or null if no protocol was negotiated.
|
Object |
getStackTraceForCloseable(String closer)
Returns an object that holds a stack trace created at the moment this method is executed.
|
boolean |
isCleartextTrafficPermitted(String hostname) |
void |
log(int level,
String message,
Throwable t) |
void |
logCloseableLeak(String message,
Object stackTrace) |
X509TrustManager |
trustManager(SSLSocketFactory sslSocketFactory) |
public static final int INFO
public static final int WARN
public static Platform get()
public String getPrefix()
public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory)
public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols)
sslSocket for route.hostname - non-null for client-side handshakes; null for server-side handshakes.public void afterHandshake(SSLSocket sslSocket)
configureTlsExtensions(javax.net.ssl.SSLSocket, java.lang.String, java.util.List<okhttp3.Protocol>).public String getSelectedProtocol(SSLSocket socket)
public void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout) throws IOException
IOExceptionpublic boolean isCleartextTrafficPermitted(String hostname)
public Object getStackTraceForCloseable(String closer)
Closeable objects and in conjunction with
logCloseableLeak(String, Object).public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager trustManager)
Copyright © 2017. All Rights Reserved.