DeleteRequest extends AsciiRequest<MemcacheStatus> { @Override public void handle(final AsciiResponse response, final HostAndPort server) throws IOException { switch (response.type) { case DELETED: succeed(MemcacheStatus.OK); return; case NOT_FOUND: succeed(MemcacheStatus.KEY_NOT_FOUND); return; default: throw new IOException("Unexpected response type: " + response.type); } } DeleteRequest(final byte[] key); @Override ByteBuf writeRequest(final ByteBufAllocator alloc, final ByteBuffer dst); @Override void handle(final AsciiResponse response, final HostAndPort server);  }
@Test public void testResponse() throws IOException, InterruptedException, ExecutionException { req.handle(AsciiResponse.DELETED, HostAndPort.fromHost("host")); assertEquals(MemcacheStatus.OK, req.get()); }
@Test public void testNonFoundResponse() throws IOException, InterruptedException, ExecutionException { req.handle(AsciiResponse.NOT_FOUND, HostAndPort.fromHost("host")); assertEquals(MemcacheStatus.KEY_NOT_FOUND, req.get()); }