/**
* Test that waiting on a request that never completes times out
*/
@Test
public void testTimeout() throws Exception {
ProduceRequestResult request = new ProduceRequestResult();
FutureRecordMetadata future = new FutureRecordMetadata(request, relOffset);
assertFalse("Request is not completed", future.isDone());
try {
future.get(5, TimeUnit.MILLISECONDS);
fail("Should have thrown exception.");
} catch (TimeoutException e) { /* this is good */
}
request.done(topicPartition, baseOffset, null);
assertTrue(future.isDone());
assertEquals(baseOffset + relOffset, future.get().offset());
}