use of javax.net.ssl.SSLSession in project robovm by robovm.
the class MySSLSession method test_getName.
/**
* javax.net.ssl.SSLSessionBindingEvent#getName()
*/
public void test_getName() {
SSLSession ses = new MySSLSession();
SSLSessionBindingEvent event = new SSLSessionBindingEvent(ses, "test");
assertEquals("Incorrect session name", "test", event.getName());
event = new SSLSessionBindingEvent(ses, null);
assertEquals("Incorrect session name", null, event.getName());
}
use of javax.net.ssl.SSLSession in project robovm by robovm.
the class SSLSessionBindingListenerTest method test_valueUnbound.
/**
* @throws IOException
* @throws UnknownHostException
* javax.net.ssl.SSLSessionBindingListener#valueUnbound(SSLSessionBindingEvent event)
*/
public void test_valueUnbound() throws UnknownHostException, IOException {
SSLSocket sock = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
SSLSession ss = sock.getSession();
mySSLSessionBindingListener sbl = new mySSLSessionBindingListener();
ss.putValue("test", sbl);
ss.removeValue("test");
assertTrue("valueUnbound was not called.", sbl.unboundDone);
}
use of javax.net.ssl.SSLSession in project robovm by robovm.
the class HttpsURLConnectionTest method checkConnectionStateParameters.
/**
* Checks the HttpsURLConnection getter's values and compares
* them with actual corresponding values of remote peer.
*/
public static void checkConnectionStateParameters(HttpsURLConnection clientConnection, SSLSocket serverPeer) throws Exception {
SSLSession session = serverPeer.getSession();
assertEquals(session.getCipherSuite(), clientConnection.getCipherSuite());
assertEquals(session.getLocalPrincipal(), clientConnection.getPeerPrincipal());
assertEquals(session.getPeerPrincipal(), clientConnection.getLocalPrincipal());
Certificate[] serverCertificates = clientConnection.getServerCertificates();
Certificate[] localCertificates = session.getLocalCertificates();
assertTrue("Server certificates differ from expected", Arrays.equals(serverCertificates, localCertificates));
localCertificates = clientConnection.getLocalCertificates();
serverCertificates = session.getPeerCertificates();
assertTrue("Local certificates differ from expected", Arrays.equals(serverCertificates, localCertificates));
}
use of javax.net.ssl.SSLSession in project robovm by robovm.
the class SSLSessionTest method test_invalidate.
/**
* javax.net.ssl.SSLSession#invalidate()
* javax.net.ssl.SSLSession#isValid()
*/
public void test_invalidate() {
SSLSession s = clientSession;
assertTrue(s.isValid());
s.invalidate();
assertFalse(s.isValid());
}
use of javax.net.ssl.SSLSession in project robovm by robovm.
the class HandshakeCompletedEventTest method test_getSession.
/**
* @throws IOException
* javax.net.ssl.HandshakeCompletedEvent#getSession()
*/
public final void test_getSession() throws IOException {
mySSLSession session = new mySSLSession("localhost", 1080, null);
SSLSocket socket = (SSLSocket) SSLSocketFactory.getDefault().createSocket();
HandshakeCompletedEvent event = new HandshakeCompletedEvent(socket, session);
SSLSession ss = event.getSession();
assertNotNull(ss);
assertEquals(session, ss);
}
Aggregations