I've heard a couple different stories about trying drugs like heroin. Some say that they felt addicted immediately, some say it takes a while. Then there's Carl Hart who says that he has occasionally done heroin for years without developing an addiction and he knows others like him.
If I had to guess, I'd say that there's a significant minority of people who can do addictive drugs without getting addicted and it's probably related to genetics. Maybe it has something to do with sensitivity to pain and executive function.
Either way, I don't plan on ever trying anything like that myself. I suspect that I'd be one of the unlucky ones.