use of javax.net.ssl.SSLParameters in project robovm by robovm.
the class SSLParametersTest method test_SSLParameters_CipherSuites.
public void test_SSLParameters_CipherSuites() {
SSLParameters p = new SSLParameters();
assertNull(p.getCipherSuites());
// confirm clone on input
String[] cipherSuites = new String[] { "fnord" };
String[] copy = cipherSuites.clone();
p.setCipherSuites(copy);
copy[0] = null;
assertEquals(Arrays.asList(cipherSuites), Arrays.asList(p.getCipherSuites()));
// confirm clone on output
assertNotSame(p.getCipherSuites(), p.getCipherSuites());
}
use of javax.net.ssl.SSLParameters in project robovm by robovm.
the class SSLParametersTest method test_SSLParameters_ClientAuth.
public void test_SSLParameters_ClientAuth() {
SSLParameters p = new SSLParameters();
assertFalse(p.getWantClientAuth());
assertFalse(p.getNeedClientAuth());
// confirm turning one on by itself
p.setWantClientAuth(true);
assertTrue(p.getWantClientAuth());
assertFalse(p.getNeedClientAuth());
// confirm turning setting on toggles the other
p.setNeedClientAuth(true);
assertFalse(p.getWantClientAuth());
assertTrue(p.getNeedClientAuth());
// confirm toggling back
p.setWantClientAuth(true);
assertTrue(p.getWantClientAuth());
assertFalse(p.getNeedClientAuth());
}
use of javax.net.ssl.SSLParameters in project robovm by robovm.
the class SSLParametersTest method test_SSLParameters_Protocols.
public void test_SSLParameters_Protocols() {
SSLParameters p = new SSLParameters();
assertNull(p.getProtocols());
// confirm clone on input
String[] protocols = new String[] { "fnord" };
String[] copy = protocols.clone();
p.setProtocols(copy);
copy[0] = null;
assertEquals(Arrays.asList(protocols), Arrays.asList(p.getProtocols()));
// confirm clone on output
assertNotSame(p.getProtocols(), p.getProtocols());
}
use of javax.net.ssl.SSLParameters in project robovm by robovm.
the class SSLEngineTest method test_SSLEngine_setSSLParameters.
public void test_SSLEngine_setSSLParameters() throws Exception {
TestSSLContext c = TestSSLContext.create();
SSLEngine e = c.clientContext.createSSLEngine();
String[] defaultCipherSuites = e.getEnabledCipherSuites();
String[] defaultProtocols = e.getEnabledProtocols();
String[] supportedCipherSuites = e.getSupportedCipherSuites();
String[] supportedProtocols = e.getSupportedProtocols();
{
SSLParameters p = new SSLParameters();
e.setSSLParameters(p);
assertEquals(Arrays.asList(defaultCipherSuites), Arrays.asList(e.getEnabledCipherSuites()));
assertEquals(Arrays.asList(defaultProtocols), Arrays.asList(e.getEnabledProtocols()));
}
{
SSLParameters p = new SSLParameters(supportedCipherSuites, supportedProtocols);
e.setSSLParameters(p);
assertEquals(Arrays.asList(supportedCipherSuites), Arrays.asList(e.getEnabledCipherSuites()));
assertEquals(Arrays.asList(supportedProtocols), Arrays.asList(e.getEnabledProtocols()));
}
{
SSLParameters p = new SSLParameters();
p.setNeedClientAuth(true);
assertFalse(e.getNeedClientAuth());
assertFalse(e.getWantClientAuth());
e.setSSLParameters(p);
assertTrue(e.getNeedClientAuth());
assertFalse(e.getWantClientAuth());
p.setWantClientAuth(true);
assertTrue(e.getNeedClientAuth());
assertFalse(e.getWantClientAuth());
e.setSSLParameters(p);
assertFalse(e.getNeedClientAuth());
assertTrue(e.getWantClientAuth());
p.setWantClientAuth(false);
assertFalse(e.getNeedClientAuth());
assertTrue(e.getWantClientAuth());
e.setSSLParameters(p);
assertFalse(e.getNeedClientAuth());
assertFalse(e.getWantClientAuth());
}
c.close();
}
use of javax.net.ssl.SSLParameters in project robovm by robovm.
the class SSLSocketTest method test_SSLSocket_setSSLParameters.
public void test_SSLSocket_setSSLParameters() throws Exception {
SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket ssl = (SSLSocket) sf.createSocket();
String[] defaultCipherSuites = ssl.getEnabledCipherSuites();
String[] defaultProtocols = ssl.getEnabledProtocols();
String[] supportedCipherSuites = ssl.getSupportedCipherSuites();
String[] supportedProtocols = ssl.getSupportedProtocols();
{
SSLParameters p = new SSLParameters();
ssl.setSSLParameters(p);
assertEquals(Arrays.asList(defaultCipherSuites), Arrays.asList(ssl.getEnabledCipherSuites()));
assertEquals(Arrays.asList(defaultProtocols), Arrays.asList(ssl.getEnabledProtocols()));
}
{
SSLParameters p = new SSLParameters(supportedCipherSuites, supportedProtocols);
ssl.setSSLParameters(p);
assertEquals(Arrays.asList(supportedCipherSuites), Arrays.asList(ssl.getEnabledCipherSuites()));
assertEquals(Arrays.asList(supportedProtocols), Arrays.asList(ssl.getEnabledProtocols()));
}
{
SSLParameters p = new SSLParameters();
p.setNeedClientAuth(true);
assertFalse(ssl.getNeedClientAuth());
assertFalse(ssl.getWantClientAuth());
ssl.setSSLParameters(p);
assertTrue(ssl.getNeedClientAuth());
assertFalse(ssl.getWantClientAuth());
p.setWantClientAuth(true);
assertTrue(ssl.getNeedClientAuth());
assertFalse(ssl.getWantClientAuth());
ssl.setSSLParameters(p);
assertFalse(ssl.getNeedClientAuth());
assertTrue(ssl.getWantClientAuth());
p.setWantClientAuth(false);
assertFalse(ssl.getNeedClientAuth());
assertTrue(ssl.getWantClientAuth());
ssl.setSSLParameters(p);
assertFalse(ssl.getNeedClientAuth());
assertFalse(ssl.getWantClientAuth());
}
}
Aggregations