equal
deleted
inserted
replaced
223 fail(); |
223 fail(); |
224 } |
224 } |
225 } |
225 } |
226 } |
226 } |
227 |
227 |
228 class DeadServerTimeoutSSLTest extends DeadServerTest { |
|
229 |
|
230 public DeadServerTimeoutSSLTest(Hashtable env) throws IOException { |
|
231 super(env); |
|
232 } |
|
233 |
|
234 public void handleNamingException(NamingException e, long start, long end) { |
|
235 if (e.getCause() instanceof SocketTimeoutException) { |
|
236 // SSL connect will timeout via readReply using |
|
237 // SocketTimeoutException |
|
238 e.printStackTrace(); |
|
239 pass(); |
|
240 } else if (e.getCause() instanceof SSLHandshakeException |
|
241 && e.getCause().getCause() instanceof EOFException) { |
|
242 // test seems to be failing intermittently on some |
|
243 // platforms. |
|
244 pass(); |
|
245 } else { |
|
246 fail(e); |
|
247 } |
|
248 } |
|
249 } |
|
250 |
|
251 |
228 |
252 class ReadServerNoTimeoutTest extends ReadServerTest { |
229 class ReadServerNoTimeoutTest extends ReadServerTest { |
253 |
230 |
254 public ReadServerNoTimeoutTest(Hashtable env, |
231 public ReadServerNoTimeoutTest(Hashtable env, |
255 ScheduledExecutorService killSwitchPool) |
232 ScheduledExecutorService killSwitchPool) |
452 if ((Boolean) test.get() == false) |
429 if ((Boolean) test.get() == false) |
453 testFailed = true; |
430 testFailed = true; |
454 } |
431 } |
455 } |
432 } |
456 |
433 |
457 // |
|
458 // Running this test serially as it seems to tickle a problem |
|
459 // on older kernels |
|
460 // |
|
461 // run the DeadServerTest with connect / read timeouts set |
|
462 // and ssl enabled |
|
463 // this should exit with a SocketTimeoutException as the root cause |
|
464 // it should also use the connect timeout instead of the read timeout |
|
465 System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL"); |
|
466 Hashtable sslenv = createEnv(); |
|
467 sslenv.put("com.sun.jndi.ldap.connect.timeout", "10"); |
|
468 sslenv.put("com.sun.jndi.ldap.read.timeout", "3000"); |
|
469 sslenv.put(Context.SECURITY_PROTOCOL, "ssl"); |
|
470 testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true; |
|
471 |
|
472 if (testFailed) { |
434 if (testFailed) { |
473 throw new AssertionError("some tests failed"); |
435 throw new AssertionError("some tests failed"); |
474 } |
436 } |
475 |
437 |
476 } finally { |
438 } finally { |