In NetworkClient.handleTimedOutRequests, we disconnect the broker connection:
This calls processDisconnection which calls cancelInFlightRequests:
We create a new ClientResponse in which the disconnected flag is set.
We then complete the record batch In Sender.handleProduceResponse with:
This seems like it could be confusing for customers that they would see network exceptions on a request timeout instead of a timeout error.
One implication of completing the batch with a network exception is that the producer will try to refresh metadata after a request timeout. I can see arguments for why this is necessary.