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");
}
}
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");
}
}
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");
}
}
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);
}
}
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
}
}
Aggregations