### Question:
ResponseExpectedRpcListener extends AbstractRpcListener<T> { public void discard() { LOG.warn("Request for {} did not receive a response", key); failedRpc(new TimeoutException("Request timed out")); } ResponseExpectedRpcListener(final Object message, final String failureInfo,
            final Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache, final RpcResponseKey key); void discard(); @SuppressWarnings("unchecked") void completed(final OfHeader message);  }### Answer:
@Test public void testDiscard() { RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName()); ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key); listener.discard(); RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message", "check switch connection", new TimeoutException("Request timed out")); SettableFuture<RpcResult<?>> result = SettableFuture.create(); result.set(RpcResultBuilder.failed().withRpcError(rpcError).build()); try { Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(), listener.getResult().get().getErrors().iterator().next().getMessage()); Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult()); Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful()); } catch (InterruptedException | ExecutionException e) { fail("Problem accessing result"); } }