Instructions:
Hold left click on the required piece of pipe, drag it with mouse and finally release it on the place you wish to connect.