use of com.yahoo.fs4.mplex.InvalidChannelException in project vespa by vespa-engine.
the class BackendTestCase method testBackend.
@Test
public void testBackend() throws IOException, InvalidChannelException {
FS4Channel channel = backend.openChannel();
Query q = new Query("/?query=a");
BasicPacket[] b = null;
int channelId = channel.getChannelId();
server.dispatch.channelId = channelId;
assertTrue(backend.sendPacket(QueryPacket.create(q), channelId));
try {
b = channel.receivePackets(1000, 1);
} catch (ChannelTimeoutException e) {
fail("Could not get packets from simulated backend.");
}
assertEquals(1, b.length);
assertEquals(217, b[0].getCode());
channel.close();
}
use of com.yahoo.fs4.mplex.InvalidChannelException in project vespa by vespa-engine.
the class BackendTestCase method requireStatistics.
@Test
public void requireStatistics() throws IOException, InvalidChannelException {
FS4Channel channel = backend.openPingChannel();
server.dispatch.channelId = -1;
server.dispatch.packetData = PONG;
assertTrue(channel.sendPacket(new PingPacket()));
try {
channel.receivePackets(1000, 1);
} catch (ChannelTimeoutException e) {
fail("Could not get packets from simulated backend.");
}
BackendStatistics stats = backend.getStatistics();
assertEquals(1, stats.totalConnections());
}
Aggregations