Maybe I have some kind of tolerance against coffe, I don't know. I have no problem drinking coffee before bed and I can't understand when people say "I can't have coffee in the afternoon because I can't sleep". It's many, many hours until bedtime! Very alien to me.
In fact, a cup of coffe has a relaxing effect on me. I guess because you are essentially taking a break. Sit down for ten minutes with a coffe and you feel much better!
Try a fairly strong coffee before bedtime. That might make a difference.
As far as relaxing, that might be because of endorphin release. Plus you are satisfying a craving.
Those who might get restless leg syndrome you need to take some kind of magnesium supplement. Your diet may be deficient in magnesium.