How is haproxy able to achive this

normal proxy return 502 on such situation, but we have tested that haproxy1.8.26 will perform good on such situation, could anyone tell me how haproxy is able to achive this?