Fully covered tests and added scenario when EOF is received to avoid infinite loops