use of javax.net.ssl.SSLSessionContext in project robovm by robovm.
the class SSLSessionContextTest method test_getSession.
/**
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* javax.net.ssl.SSLSessionContex#getSession(byte[] sessionId)
*/
public final void test_getSession() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, null);
SSLSessionContext sc = context.getClientSessionContext();
try {
sc.getSession(null);
} catch (NullPointerException e) {
// expected
}
assertNull(sc.getSession(new byte[5]));
}
use of javax.net.ssl.SSLSessionContext in project robovm by robovm.
the class SSLSessionContextTest method test_getIds.
/**
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* javax.net.ssl.SSLSessionContex#getIds()
*/
public final void test_getIds() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, null);
SSLSessionContext sc = context.getClientSessionContext();
assertFalse(sc.getIds().hasMoreElements());
}
use of javax.net.ssl.SSLSessionContext in project jdk8u_jdk by JetBrains.
the class Timeout method main.
public static void main(String[] args) throws Exception {
// try {
SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket();
String[] protocols = ss.getSupportedProtocols();
for (int i = 0; i < protocols.length; i++) {
// try {
if (protocols[i].equals("SSLv2Hello")) {
continue;
}
SSLContext sslc = SSLContext.getInstance(protocols[i]);
SSLSessionContext sslsc = sslc.getServerSessionContext();
System.out.println("Protocol: " + protocols[i]);
sslsc.setSessionTimeout(Integer.MAX_VALUE);
int newtime = sslsc.getSessionTimeout();
if (newtime != Integer.MAX_VALUE) {
throw new Exception("Expected timeout: " + Integer.MAX_VALUE + ", got instead: " + newtime);
}
// } catch (Exception e) {
// }
}
// } catch (Exception e) {
// System.out.println(e);
// }
System.out.println("Finished");
}
Aggregations