use of com.yahoo.messagebus.jdisc.test.RemoteClient in project vespa by vespa-engine.
the class SharedDestinationSessionTestCase method requireThatSessionCanSendReply.
@Test
public void requireThatSessionCanSendReply() throws InterruptedException {
RemoteClient client = RemoteClient.newInstanceWithInternSlobrok();
MessageQueue queue = new MessageQueue();
DestinationSessionParams params = new DestinationSessionParams().setMessageHandler(queue);
SharedDestinationSession session = newDestinationSession(client.slobrokId(), params);
Route route = Route.parse(session.connectionSpec());
assertTrue(client.sendMessage(new SimpleMessage("foo").setRoute(route)).isAccepted());
Message msg = queue.awaitMessage(60, TimeUnit.SECONDS);
assertNotNull(msg);
Reply reply = new SimpleReply("bar");
reply.swapState(msg);
session.sendReply(reply);
assertNotNull(client.awaitReply(60, TimeUnit.SECONDS));
session.release();
client.close();
}
use of com.yahoo.messagebus.jdisc.test.RemoteClient in project vespa by vespa-engine.
the class SharedIntermediateSessionTestCase method requireThatSessionCanSendReply.
@Test
public void requireThatSessionCanSendReply() throws InterruptedException {
RemoteClient client = RemoteClient.newInstanceWithInternSlobrok();
MessageQueue queue = new MessageQueue();
IntermediateSessionParams params = new IntermediateSessionParams().setMessageHandler(queue);
SharedIntermediateSession session = newIntermediateSession(client.slobrokId(), params);
Route route = Route.parse(session.connectionSpec());
assertTrue(client.sendMessage(new SimpleMessage("foo").setRoute(route)).isAccepted());
Message msg = queue.awaitMessage(60, TimeUnit.SECONDS);
assertNotNull(msg);
Reply reply = new SimpleReply("bar");
reply.swapState(msg);
session.sendReply(reply);
assertNotNull(client.awaitReply(60, TimeUnit.SECONDS));
session.release();
client.close();
}
Aggregations