diff options
-rw-r--r-- | luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp | 7 | ||||
-rw-r--r-- | luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java | 19 |
2 files changed, 16 insertions, 10 deletions
diff --git a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp index 83f28d2c12..348960de7b 100644 --- a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp +++ b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp @@ -3955,7 +3955,8 @@ static jint NativeCrypto_SSL_read(JNIEnv* env, jclass, jint ssl_address, jobject */ static int sslWrite(JNIEnv* env, SSL* ssl, jobject fdObject, jobject shc, const char* buf, jint len, int* sslReturnCode, int* sslErrorCode, int write_timeout_millis) { - JNI_TRACE("ssl=%p sslWrite buf=%p len=%d", ssl, buf, len); + JNI_TRACE("ssl=%p sslWrite buf=%p len=%d write_timeout_millis=%d", + ssl, buf, len, write_timeout_millis); if (len == 0) { // Don't bother doing anything in this case. @@ -4094,8 +4095,8 @@ static void NativeCrypto_SSL_write(JNIEnv* env, jclass, jint ssl_address, jobjec jobject shc, jbyteArray b, jint offset, jint len, jint write_timeout_millis) { SSL* ssl = to_SSL(env, ssl_address, true); - JNI_TRACE("ssl=%p NativeCrypto_SSL_write fd=%p shc=%p b=%p offset=%d len=%d", - ssl, fdObject, shc, b, offset, len); + JNI_TRACE("ssl=%p NativeCrypto_SSL_write fd=%p shc=%p b=%p offset=%d len=%d write_timeout_millis=%d", + ssl, fdObject, shc, b, offset, len, write_timeout_millis); if (ssl == NULL) { return; } diff --git a/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java b/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java index a215445ea5..f5cb7fdbfe 100644 --- a/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java +++ b/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java @@ -868,17 +868,21 @@ public class NativeCryptoTest extends TestCase { Socket sock, FileDescriptor fd, SSLHandshakeCallbacks callback) throws Exception { - NativeCrypto.SSL_set_verify(s, NativeCrypto.SSL_VERIFY_PEER); - NativeCrypto.SSL_set_options( - s, NativeCrypto.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); - NativeCrypto.SSL_renegotiate(s); - NativeCrypto.SSL_write(s, fd, callback, new byte[] { 42 }, 0, 1, 0); - super.afterHandshake(session, s, c, sock, fd, callback); + try { + NativeCrypto.SSL_set_verify(s, NativeCrypto.SSL_VERIFY_PEER); + NativeCrypto.SSL_set_options( + s, NativeCrypto.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + NativeCrypto.SSL_renegotiate(s); + NativeCrypto.SSL_write(s, fd, callback, new byte[] { 42 }, 0, 1, + (int) ((TIMEOUT_SECONDS * 1000) / 2)); + } catch (SocketTimeoutException expected) { + } finally { + super.afterHandshake(session, s, c, sock, fd, callback); + } } }; Future<TestSSLHandshakeCallbacks> client = handshake(listener, 0, true, cHooks, null); Future<TestSSLHandshakeCallbacks> server = handshake(listener, 0, false, sHooks, null); - server.get(TIMEOUT_SECONDS, TimeUnit.SECONDS); try { client.get(TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (ExecutionException e) { @@ -886,6 +890,7 @@ public class NativeCryptoTest extends TestCase { throw e; } } + server.get(TIMEOUT_SECONDS, TimeUnit.SECONDS); } public void test_SSL_do_handshake_client_timeout() throws Exception { |