本文整理汇总了Java中com.android.org.conscrypt.OpenSSLSocketImpl类的典型用法代码示例。如果您正苦于以下问题:Java OpenSSLSocketImpl类的具体用法?Java OpenSSLSocketImpl怎么用?Java OpenSSLSocketImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpenSSLSocketImpl类属于com.android.org.conscrypt包,在下文中一共展示了OpenSSLSocketImpl类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableTlsExtensions
import com.android.org.conscrypt.OpenSSLSocketImpl; //导入依赖的package包/类
public void enableTlsExtensions(SSLSocket socket, String uriHost) {
if (socket instanceof OpenSSLSocketImpl) {
OpenSSLSocketImpl openSSLSocket = (OpenSSLSocketImpl) socket;
openSSLSocket.setUseSessionTickets(true);
openSSLSocket.setHostname(uriHost);
}
}
示例2: getNpnSelectedProtocol
import com.android.org.conscrypt.OpenSSLSocketImpl; //导入依赖的package包/类
/**
* Returns the negotiated protocol, or null if no protocol was negotiated.
*/
public ByteString getNpnSelectedProtocol(SSLSocket socket) {
if (!(socket instanceof OpenSSLSocketImpl)) {
return null;
}
OpenSSLSocketImpl socketImpl = (OpenSSLSocketImpl) socket;
// Prefer ALPN's result if it is present.
byte[] alpnResult = socketImpl.getAlpnSelectedProtocol();
if (alpnResult != null) {
return ByteString.of(alpnResult);
}
byte[] npnResult = socketImpl.getNpnSelectedProtocol();
return npnResult == null ? null : ByteString.of(npnResult);
}
示例3: setNpnProtocols
import com.android.org.conscrypt.OpenSSLSocketImpl; //导入依赖的package包/类
/**
* Sets client-supported protocols on a socket to send to a server. The
* protocols are only sent if the socket implementation supports NPN.
*/
public void setNpnProtocols(SSLSocket socket, List<Protocol> npnProtocols) {
if (socket instanceof OpenSSLSocketImpl) {
OpenSSLSocketImpl socketImpl = (OpenSSLSocketImpl) socket;
byte[] protocols = concatLengthPrefixed(npnProtocols);
socketImpl.setAlpnProtocols(protocols);
socketImpl.setNpnProtocols(protocols);
}
}
示例4: getNpnSelectedProtocol
import com.android.org.conscrypt.OpenSSLSocketImpl; //导入依赖的package包/类
/**
* Returns the negotiated protocol, or null if no protocol was negotiated.
*/
public byte[] getNpnSelectedProtocol(SSLSocket socket) {
return socket instanceof OpenSSLSocketImpl
? ((OpenSSLSocketImpl) socket).getNpnSelectedProtocol()
: null;
}
示例5: setNpnProtocols
import com.android.org.conscrypt.OpenSSLSocketImpl; //导入依赖的package包/类
/**
* Sets client-supported protocols on a socket to send to a server. The
* protocols are only sent if the socket implementation supports NPN.
*/
public void setNpnProtocols(SSLSocket socket, byte[] npnProtocols) {
if (socket instanceof OpenSSLSocketImpl) {
((OpenSSLSocketImpl) socket).setNpnProtocols(npnProtocols);
}
}