A man who threatened a victim with a needle, saying it contained contaminated blood, has been jailed for 18 months.