use of javax.net.ssl.SSLServerSocket in project robovm by robovm.
the class SSLServerSocketTest method test_EnableSessionCreation.
/**
* @throws IOException
* javax.net.ssl.SSLServerSocket#setEnableSessionCreation(boolean flag)
* javax.net.ssl.SSLServerSocket#getEnableSessionCreation()
*/
public void test_EnableSessionCreation() throws Exception {
SSLServerSocket sss = getSSLServerSocket();
assertTrue(sss.getEnableSessionCreation());
sss.setEnableSessionCreation(false);
assertFalse(sss.getEnableSessionCreation());
sss.setEnableSessionCreation(true);
assertTrue(sss.getEnableSessionCreation());
}
use of javax.net.ssl.SSLServerSocket in project robovm by robovm.
the class SSLServerSocketTest method test_EnabledCipherSuites.
/**
* @throws IOException
* javax.net.ssl.SSLServerSocket#getEnabledCipherSuites()
* javax.net.ssl.SSLServerSocket#setEnabledCipherSuites(String[] suites)
*/
public void test_EnabledCipherSuites() throws Exception {
SSLServerSocket sss = getSSLServerSocket();
try {
sss.setEnabledCipherSuites(null);
} catch (IllegalArgumentException iae) {
//expected
}
String[] unsupportedCipherSuites = { "unsupported" };
try {
sss.setEnabledCipherSuites(unsupportedCipherSuites);
} catch (IllegalArgumentException iae) {
//expected
}
int count = sss.getSupportedCipherSuites().length;
assertTrue("No supported cipher suites", count > 0);
sss.setEnabledCipherSuites(sss.getSupportedCipherSuites());
String[] res = sss.getEnabledCipherSuites();
assertNotNull("NULL result", res);
assertEquals("not all supported cipher suites were enabled", Arrays.asList(sss.getSupportedCipherSuites()), Arrays.asList(res));
}
use of javax.net.ssl.SSLServerSocket in project robovm by robovm.
the class SSLServerSocketTest method test_NeedClientAuth.
/**
* @throws IOException
* javax.net.ssl.SSLServerSocket#setNeedClientAuth(boolean need)
* javax.net.ssl.SSLServerSocket#getNeedClientAuthCreation()
*/
public void test_NeedClientAuth() throws Exception {
SSLServerSocket sss = getSSLServerSocket();
sss.setNeedClientAuth(true);
assertTrue(sss.getNeedClientAuth());
sss.setNeedClientAuth(false);
assertFalse(sss.getNeedClientAuth());
}
use of javax.net.ssl.SSLServerSocket in project robovm by robovm.
the class SSLServerSocketTest method testConstructor_I.
/**
* javax.net.ssl.SSLServerSocket#SSLServerSocket(int port)
*/
public void testConstructor_I() throws Exception {
int[] port_invalid = { -1, 65536, Integer.MIN_VALUE, Integer.MAX_VALUE };
SSLServerSocket ssl = new mySSLServerSocket(0);
for (int i = 0; i < port_invalid.length; i++) {
try {
new mySSLServerSocket(port_invalid[i]);
fail("IllegalArgumentException should be thrown");
} catch (IllegalArgumentException expected) {
}
}
try {
new mySSLServerSocket(ssl.getLocalPort());
fail("IOException Expected when opening an already opened port");
} catch (IOException expected) {
}
}
use of javax.net.ssl.SSLServerSocket in project robovm by robovm.
the class SSLServerSocketTest method test_UseClientMode.
/**
* @throws IOException
* javax.net.ssl.SSLServerSocket#getUseClientMode()
* javax.net.ssl.SSLServerSocket#setUseClientMode(boolean mode)
*/
public void test_UseClientMode() throws Exception {
SSLServerSocket sss = getSSLServerSocket();
sss.setUseClientMode(false);
assertFalse(sss.getUseClientMode());
sss.setUseClientMode(true);
assertTrue(sss.getUseClientMode());
}
Aggregations