Author: david.lloyd(a)jboss.com
Date: 2008-11-12 00:29:27 -0500 (Wed, 12 Nov 2008)
New Revision: 4656
Modified:
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java
Log:
Add 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:21:58 UTC (rev 4655)
+++
remoting3/trunk/core/src/test/java/org/jboss/remoting/core/EndpointTestCase.java 2008-11-12
05:29:27 UTC (rev 4656)
@@ -33,10 +33,12 @@
import org.jboss.remoting.RemoteExecutionException;
import org.jboss.remoting.CloseHandler;
import org.jboss.remoting.Client;
+import org.jboss.remoting.IndeterminateOutcomeException;
import org.jboss.remoting.test.support.LoggingHelper;
import org.jboss.remoting.spi.RequestHandler;
import org.jboss.remoting.spi.Handle;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.IoFuture;
import org.jboss.xnio.log.Logger;
/**
@@ -184,4 +186,35 @@
executorService.shutdownNow();
}
}
+
+ public void testUnsentReply() 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);
+ // don't send a reply!!
+ }
+ }, 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();
+ }
+ }
}
Show replies by date