How to connect sphere to a multipipe?

Hiya, Im trying to make a ball joint and socket connection so would like to connect the end of these pipes smoothly to a sphere so it can then slot into the pipe below it? Any help is appreciated!