The proverb just means that we shall know who our real friends are when we are in need. Those who desert us when we are in difficulties are just unfaithful friends.
A true friend would remain with us whether we are rich or poor. Some people befriend the rich, simply for the sake of getting benefits from them.
It is useless to have insincere friends, we may have hundreds of such friends, but these friends shall remain with us as long as we are rich and powerful. It is better to have one or two good friends rather than having hundreds of insincere ones.
A true friend will stand by us in our trials and tribulations. He will be the greatest source of consolation and comfort in our adversities. So we must be careful in choosing our friends. It is difficult to choose a sincere friend overnight as it takes years for us to find a sincere friend.