Patch available for review.
The second case should be OffsetRequest.Latest
Also, the latestOffset val in getEarliestOrLatestOffset would be better renamed to earliestOrLatestOffset.
Good catch. Uploaded v2 patch.
Also, in the function earliestOrLatestOffset, the variable still says latestOffset. Can you rename it to say earliestOrLatestOffset ?
Attached v3. Fixed variable name and message in the exception.