use of javax.net.ssl.SSLEngine 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 javax.net.ssl.SSLEngine in project robovm by robovm.
the class SSLEngineTest method test_unwrap_ByteBuffer_ByteBuffer_05.
/**
* javax.net.ssl.SSLEngine#unwrap(ByteBuffer src, ByteBuffer dst)
*/
public void test_unwrap_ByteBuffer_ByteBuffer_05() {
String host = "new host";
int port = 8080;
ByteBuffer bbs = ByteBuffer.allocate(10);
ByteBuffer bbd = ByteBuffer.allocate(100);
SSLEngine sse = getEngine(host, port);
sse.setUseClientMode(true);
try {
SSLEngineResult res = sse.unwrap(bbs, bbd);
assertEquals(0, res.bytesConsumed());
assertEquals(0, res.bytesProduced());
} catch (Exception e) {
fail("Unexpected exception: " + e);
}
}
use of javax.net.ssl.SSLEngine in project robovm by robovm.
the class SSLEngineTest method test_wrap_ByteBuffer$ByteBuffer_04.
/**
* javax.net.ssl.SSLEngine#wrap(ByteBuffer[] srcs, ByteBuffer dst)
* IllegalStateException should be thrown.
*/
@AndroidOnly("The RI doesn't throw the IllegalStateException.")
public void test_wrap_ByteBuffer$ByteBuffer_04() {
String host = "new host";
int port = 8080;
ByteBuffer bb = ByteBuffer.allocate(10);
ByteBuffer[] bbA = { ByteBuffer.allocate(5), ByteBuffer.allocate(10), ByteBuffer.allocate(5) };
SSLEngine sse = getEngine(host, port);
try {
sse.wrap(bbA, bb);
fail("IllegalStateException wasn't thrown");
} catch (IllegalStateException iobe) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of IllegalStateException");
}
}
use of javax.net.ssl.SSLEngine in project robovm by robovm.
the class SSLEngineTest method test_unwrap_ByteBuffer_ByteBuffer_04.
/**
* javax.net.ssl.SSLEngine#unwrap(ByteBuffer src, ByteBuffer dst)
* IllegalStateException should be thrown.
*/
@AndroidOnly("The RI doesn't throw the IllegalStateException.")
public void test_unwrap_ByteBuffer_ByteBuffer_04() {
String host = "new host";
int port = 8080;
ByteBuffer bbs = ByteBuffer.allocate(10);
ByteBuffer bbd = ByteBuffer.allocate(100);
SSLEngine sse = getEngine(host, port);
try {
sse.unwrap(bbs, bbd);
fail("IllegalStateException wasn't thrown");
} catch (IllegalStateException iobe) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of IllegalStateException");
}
}
use of javax.net.ssl.SSLEngine in project robovm by robovm.
the class SSLEngineTest method test_closeOutbound.
/**
* @throws NoSuchAlgorithmException
* javax.net.ssl.SSLEngine#closeOutbound()
* javax.net.ssl.SSLEngine#isOutboundDone()
*/
public void test_closeOutbound() throws NoSuchAlgorithmException {
SSLEngine sse = getEngine();
try {
assertFalse(sse.isOutboundDone());
sse.closeOutbound();
assertTrue(sse.isOutboundDone());
} catch (Exception ex) {
fail("Unexpected exception: " + ex);
}
}
Aggregations