Search in sources :

Example 76 with SSLSocket

use of javax.net.ssl.SSLSocket in project robovm by robovm.

the class SSLSocketTest method test_getSupportedProtocols.

/**
     * javax.net.ssl.SSLSocket#getSupportedProtocols()
     */
public void test_getSupportedProtocols() throws IOException {
    SSLSocket ssl = getSSLSocket();
    String[] res = ssl.getSupportedProtocols();
    assertTrue("No supported protocols found", res.length > 0);
    ssl.close();
}
Also used : SSLSocket(javax.net.ssl.SSLSocket)

Example 77 with SSLSocket

use of javax.net.ssl.SSLSocket in project robovm by robovm.

the class SSLSocketTest method test_getSupportedCipherSuites.

/**
     * javax.net.ssl.SSLSocket#getSupportedCipherSuites()
     */
public void test_getSupportedCipherSuites() throws IOException {
    SSLSocket ssl = getSSLSocket();
    String[] res = ssl.getSupportedCipherSuites();
    assertTrue("no supported cipher suites", res.length > 0);
    ssl.close();
}
Also used : SSLSocket(javax.net.ssl.SSLSocket)

Example 78 with SSLSocket

use of javax.net.ssl.SSLSocket in project robovm by robovm.

the class SSLSocketTest method test_addHandshakeCompletedListener.

/**
     * javax.net.ssl.SSLSocket#addHandshakeCompletedListener(HandshakeCompletedListener listener)
     */
@AndroidOnly("RI doesn't throw the specified IAE")
public void test_addHandshakeCompletedListener() throws IOException {
    SSLSocket ssl = getSSLSocket();
    HandshakeCompletedListener ls = new HandshakeCL();
    try {
        ssl.addHandshakeCompletedListener(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    ssl.addHandshakeCompletedListener(ls);
    ssl.close();
}
Also used : HandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener) SSLSocket(javax.net.ssl.SSLSocket) AndroidOnly(dalvik.annotation.AndroidOnly)

Example 79 with SSLSocket

use of javax.net.ssl.SSLSocket in project robovm by robovm.

the class SSLSocketTest method test_EnabledCipherSuites.

/**
     * javax.net.ssl.SSLSocket#getEnabledCipherSuites()
     * javax.net.ssl.SSLSocket#setEnabledCipherSuites(String[] suites)
     */
public void test_EnabledCipherSuites() throws IOException {
    SSLSocket ssl = getSSLSocket();
    try {
        ssl.setEnabledCipherSuites(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    ssl.setEnabledCipherSuites(new String[] {});
    try {
        ssl.setEnabledCipherSuites(new String[] { "blubb" });
        fail();
    } catch (IllegalArgumentException expected) {
    }
    ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites());
    String[] res = ssl.getEnabledCipherSuites();
    assertNotNull("NULL result", res);
    assertEquals("not all supported cipher suites were enabled", Arrays.asList(ssl.getSupportedCipherSuites()), Arrays.asList(res));
    ssl.close();
}
Also used : SSLSocket(javax.net.ssl.SSLSocket)

Example 80 with SSLSocket

use of javax.net.ssl.SSLSocket in project robovm by robovm.

the class SSLSocketTest method testConstructor.

/**
     * javax.net.ssl.SSLSocket#SSLSocket()
     */
public void testConstructor() throws Exception {
    SSLSocket ssl = getSSLSocket();
    assertNotNull(ssl);
    ssl.close();
}
Also used : SSLSocket(javax.net.ssl.SSLSocket)

Aggregations

SSLSocket (javax.net.ssl.SSLSocket)326 IOException (java.io.IOException)101 Test (org.junit.Test)62 SSLContext (javax.net.ssl.SSLContext)59 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)59 Socket (java.net.Socket)57 OutputStream (java.io.OutputStream)50 InetSocketAddress (java.net.InetSocketAddress)39 CertificateException (java.security.cert.CertificateException)33 SSLException (javax.net.ssl.SSLException)32 SSLSession (javax.net.ssl.SSLSession)31 InputStream (java.io.InputStream)30 SSLPeerUnverifiedException (javax.net.ssl.SSLPeerUnverifiedException)30 SSLServerSocket (javax.net.ssl.SSLServerSocket)27 SocketTimeoutException (java.net.SocketTimeoutException)24 SocketException (java.net.SocketException)23 ServerSocket (java.net.ServerSocket)22 UnknownHostException (java.net.UnknownHostException)21 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)21 InputStreamReader (java.io.InputStreamReader)19