added handling for Connection refused in Server