For getting data from remote url which connection type will work fast URLConnection or Socket.
It does not matter which one is faster both of these have different purposes. A socket is an endpoint for communication between two machines and need to access different protocol. Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine. In short if you need to communicate with the other machine or device implement socket and if you want to read data from server use URLconnection.
Happy Coding :D