Fixed a bug with incorrect URL when base URI with trailing slash is used.

When I used URI like "http://test.com/", SocketIOClient tried to connect to http://test.com//socket.io/1/" what caused strange errors. I made a simple Regex fix + tiny refactoring.

Cheers!
Filip