Author: david.lloyd(a)jboss.com
Date: 2008-11-12 00:48:32 -0500 (Wed, 12 Nov 2008)
New Revision: 4657
Modified:
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java
Log:
Add more involved unsent reply test
Modified:
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java
===================================================================
---
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java 2008-11-12
05:29:27 UTC (rev 4656)
+++
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java 2008-11-12
05:48:32 UTC (rev 4657)
@@ -217,4 +217,54 @@
executorService.shutdownNow();
}
}
+
+ public void testUnsentReply2() throws Throwable {
+ final EndpointImpl endpoint = new EndpointImpl();
+ final ExecutorService executorService = Executors.newCachedThreadPool();
+ final Object requestObj = new Object();
+ try {
+ endpoint.setExecutor(executorService);
+ endpoint.start();
+ try {
+ final Handle<RequestHandler> handle =
endpoint.createRequestHandler(new AbstractRequestListener<Object, Object>() {
+ public void handleRequest(final RequestContext<Object> context,
final Object request) throws RemoteExecutionException {
+ assertEquals(request, requestObj);
+ context.execute(new Runnable() {
+ public void run() {
+ context.execute(new Runnable() {
+ public void run() {
+ context.execute(new Runnable() {
+ public void run() {
+ }
+ });
+ }
+ });
+ context.execute(new Runnable() {
+ public void run() {
+ }
+ });
+ }
+ });
+ context.execute(new Runnable() {
+ public void run() {
+ }
+ });
+ }
+ }, Object.class, Object.class);
+ final RequestHandler requestHandler = handle.getResource();
+ try {
+ final Client<Object,Object> client =
endpoint.createClient(requestHandler, Object.class, Object.class);
+ final IoFuture<Object> futureReply = client.send(requestObj);
+ assertEquals(IoFuture.Status.FAILED, futureReply.await(500L,
TimeUnit.MILLISECONDS));
+ assertTrue(futureReply.getException() instanceof
IndeterminateOutcomeException);
+ } finally {
+ IoUtils.safeClose(requestHandler);
+ }
+ } finally {
+ safeStop(endpoint);
+ }
+ } finally {
+ executorService.shutdownNow();
+ }
+ }
}