Search in sources :

Example 16 with KnownFailure

use of dalvik.annotation.KnownFailure in project robovm by robovm.

the class SSLEngineTest method test_wrap_04.

/**
     * javax.net.ssl.SSLEngine#wrap(ByteBuffer[] srcs, int offset,
     *                                     int length, ByteBuffer dst)
     * Exception case: IllegalArgumentException should be thrown.
     */
@KnownFailure("Fixed on DonutBurger, Wrong Exception thrown")
public void test_wrap_04() {
    String host = "new host";
    int port = 8080;
    ByteBuffer[] bbA = { ByteBuffer.allocate(100), ByteBuffer.allocate(10), ByteBuffer.allocate(100) };
    ByteBuffer[] bbN = null;
    ByteBuffer bN = null;
    SSLEngine e = getEngine(host, port);
    e.setUseClientMode(true);
    try {
        e.wrap(bbA, 0, 3, bN);
        fail("IllegalArgumentException must be thrown for null srcs byte buffer array");
    } catch (NullPointerException npe) {
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        fail(ex + " was thrown instead of IllegalArgumentException");
    }
    try {
        e.wrap(bbN, 0, 0, bN);
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException ex) {
    } catch (NullPointerException npe) {
    } catch (Exception ex) {
        fail(ex + " was thrown instead of IllegalArgumentException");
    }
}
Also used : SSLEngine(javax.net.ssl.SSLEngine) ByteBuffer(java.nio.ByteBuffer) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) SSLException(javax.net.ssl.SSLException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ReadOnlyBufferException(java.nio.ReadOnlyBufferException) KnownFailure(dalvik.annotation.KnownFailure)

Example 17 with KnownFailure

use of dalvik.annotation.KnownFailure in project robovm by robovm.

the class SSLEngineTest method test_wrap_ByteBuffer_ByteBuffer_03.

/**
     * javax.net.ssl.SSLEngine#wrap(ByteBuffer src, ByteBuffer dst)
     * IllegalArgumentException should be thrown.
     */
@KnownFailure("Fixed on DonutBurger, Wrong Exception thrown")
public void test_wrap_ByteBuffer_ByteBuffer_03() {
    String host = "new host";
    int port = 8080;
    ByteBuffer bbsN = null;
    ByteBuffer bbdN = null;
    ByteBuffer bbs = ByteBuffer.allocate(10);
    ByteBuffer bbd = ByteBuffer.allocate(100);
    SSLEngine sse = getEngine(host, port);
    sse.setUseClientMode(true);
    try {
        sse.wrap(bbsN, bbd);
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException iae) {
    //expected
    } catch (NullPointerException npe) {
    } catch (Exception e) {
        fail(e + " was thrown instead of IllegalArgumentException");
    }
    try {
        sse.wrap(bbs, bbdN);
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException iae) {
    //expected
    } catch (NullPointerException npe) {
    } catch (Exception e) {
        fail(e + " was thrown instead of IllegalArgumentException");
    }
    try {
        sse.wrap(bbsN, bbdN);
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException iae) {
    //expected
    } catch (NullPointerException npe) {
    } catch (Exception e) {
        fail(e + " was thrown instead of IllegalArgumentException");
    }
}
Also used : SSLEngine(javax.net.ssl.SSLEngine) ByteBuffer(java.nio.ByteBuffer) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) SSLException(javax.net.ssl.SSLException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ReadOnlyBufferException(java.nio.ReadOnlyBufferException) KnownFailure(dalvik.annotation.KnownFailure)

Example 18 with KnownFailure

use of dalvik.annotation.KnownFailure in project robovm by robovm.

the class SSLEngineTest method test_unwrap_ByteBuffer$ByteBuffer_02.

/**
     * javax.net.ssl.SSLEngine#unwrap(ByteBuffer src, ByteBuffer[] dsts)
     * ReadOnlyBufferException should be thrown.
     */
@KnownFailure("Fixed on DonutBurger, Wrong Exception thrown")
public void test_unwrap_ByteBuffer$ByteBuffer_02() {
    String host = "new host";
    int port = 8080;
    ByteBuffer bbs = ByteBuffer.allocate(10);
    ByteBuffer bbR = ByteBuffer.allocate(100).asReadOnlyBuffer();
    ByteBuffer[] bbA = { bbR, ByteBuffer.allocate(10), ByteBuffer.allocate(100) };
    SSLEngine sse = getEngine(host, port);
    sse.setUseClientMode(true);
    try {
        sse.unwrap(bbs, bbA);
        fail("ReadOnlyBufferException wasn't thrown");
    } catch (ReadOnlyBufferException iobe) {
    //expected
    } catch (Exception e) {
        fail(e + " was thrown instead of ReadOnlyBufferException");
    }
}
Also used : ReadOnlyBufferException(java.nio.ReadOnlyBufferException) SSLEngine(javax.net.ssl.SSLEngine) ByteBuffer(java.nio.ByteBuffer) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) SSLException(javax.net.ssl.SSLException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ReadOnlyBufferException(java.nio.ReadOnlyBufferException) KnownFailure(dalvik.annotation.KnownFailure)

Example 19 with KnownFailure

use of dalvik.annotation.KnownFailure in project robovm by robovm.

the class myTrustManagerFactory method test_initLjavax_net_ssl_ManagerFactoryParameters.

/**
     * Test for <code>init(ManagerFactoryParameters params)</code>
     * Assertion:
     * throws InvalidAlgorithmParameterException when params is null
     */
@KnownFailure("ManagerFactoryParameters object is not supported " + "and InvalidAlgorithmParameterException was thrown.")
public void test_initLjavax_net_ssl_ManagerFactoryParameters() throws Exception {
    ManagerFactoryParameters par = null;
    TrustManagerFactory[] trustMF = createTMFac();
    assertNotNull("TrustManagerFactory objects were not created", trustMF);
    for (int i = 0; i < trustMF.length; i++) {
        try {
            trustMF[i].init(par);
            fail("InvalidAlgorithmParameterException must be thrown");
        } catch (InvalidAlgorithmParameterException e) {
        }
    }
    String keyAlg = "DSA";
    String validCaNameRfc2253 = ("CN=Test CA," + "OU=Testing Division," + "O=Test It All," + "L=Test Town," + "ST=Testifornia," + "C=Testland");
    try {
        KeyStore kStore = KeyStore.getInstance(KeyStore.getDefaultType());
        kStore.load(null, null);
        PublicKey pk = new TestKeyPair(keyAlg).getPublic();
        TrustAnchor ta = new TrustAnchor(validCaNameRfc2253, pk, getFullEncoding());
        Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
        trustAnchors.add(ta);
        X509CertSelector xcs = new X509CertSelector();
        PKIXBuilderParameters pkixBP = new PKIXBuilderParameters(trustAnchors, xcs);
        CertPathTrustManagerParameters cptmp = new CertPathTrustManagerParameters(pkixBP);
        TrustManagerFactory tmf = TrustManagerFactory.getInstance(getDefaultAlgorithm());
        try {
            tmf.init(cptmp);
        } catch (Exception ex) {
            fail(ex + " was thrown for init(ManagerFactoryParameters spec)");
        }
    } catch (Exception e) {
        fail("Unexpected exception for configuration: " + e);
    }
}
Also used : TestKeyPair(org.apache.harmony.security.tests.support.TestKeyPair) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) PublicKey(java.security.PublicKey) PKIXBuilderParameters(java.security.cert.PKIXBuilderParameters) CertPathTrustManagerParameters(javax.net.ssl.CertPathTrustManagerParameters) TrustAnchor(java.security.cert.TrustAnchor) X509CertSelector(java.security.cert.X509CertSelector) KeyStore(java.security.KeyStore) KeyStoreException(java.security.KeyStoreException) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) NoSuchProviderException(java.security.NoSuchProviderException) TrustManagerFactory(javax.net.ssl.TrustManagerFactory) ManagerFactoryParameters(javax.net.ssl.ManagerFactoryParameters) HashSet(java.util.HashSet) KnownFailure(dalvik.annotation.KnownFailure)

Example 20 with KnownFailure

use of dalvik.annotation.KnownFailure in project robovm by robovm.

the class SSLEngineTest method test_unwrap_02.

/**
     * javax.net.ssl.SSLEngine#unwrap(ByteBuffer src, ByteBuffer[] dsts,
     *                                       int offset, int length)
     * Exception case: IndexOutOfBoundsException should be thrown.
     */
@KnownFailure("Fixed in DonutBurger, boundary checks missing")
public void test_unwrap_02() throws SSLException {
    String host = "new host";
    int port = 8080;
    ByteBuffer[] bbA = { ByteBuffer.allocate(100), ByteBuffer.allocate(10), ByteBuffer.allocate(100) };
    ByteBuffer bb = ByteBuffer.allocate(10);
    SSLEngine sse = getEngine(host, port);
    sse.setUseClientMode(true);
    try {
        sse.unwrap(bb, bbA, -1, 3);
        fail("IndexOutOfBoundsException wasn't thrown");
    } catch (IndexOutOfBoundsException iobe) {
    //expected
    }
    try {
        sse.unwrap(bb, bbA, 0, -3);
        fail("IndexOutOfBoundsException wasn't thrown");
    } catch (IndexOutOfBoundsException iobe) {
    //expected
    }
    try {
        sse.unwrap(bb, bbA, bbA.length + 1, bbA.length);
        fail("IndexOutOfBoundsException wasn't thrown");
    } catch (IndexOutOfBoundsException iobe) {
    //expected
    }
    try {
        sse.unwrap(bb, bbA, 0, bbA.length + 1);
        fail("IndexOutOfBoundsException wasn't thrown");
    } catch (IndexOutOfBoundsException iobe) {
    //expected
    }
}
Also used : SSLEngine(javax.net.ssl.SSLEngine) ByteBuffer(java.nio.ByteBuffer) KnownFailure(dalvik.annotation.KnownFailure)

Aggregations

KnownFailure (dalvik.annotation.KnownFailure)39 ResultSet (java.sql.ResultSet)21 IOException (java.io.IOException)12 SQLException (java.sql.SQLException)12 ByteBuffer (java.nio.ByteBuffer)11 SSLEngine (javax.net.ssl.SSLEngine)11 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)10 ReadOnlyBufferException (java.nio.ReadOnlyBufferException)9 KeyManagementException (java.security.KeyManagementException)9 ResultSetMetaData (java.sql.ResultSetMetaData)9 SSLException (javax.net.ssl.SSLException)9 URL (java.net.URL)2 URLClassLoader (java.net.URLClassLoader)2 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)2 HashSet (java.util.HashSet)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1