changed response code from 500 to 502 when target does not accept the TCP connection