I am trying to limit the amount of data transmitted through an URLConnection per second. I implemented a wrapper for InputStreams and OutputStreams, as well as for sockets that utilize these streams. Next I created a custom SocketFactory that provides the limited sockets. But now the problem is that I dont know how I can set up an URLConnection that uses my SocketFactory. Do you have any ideas how to realise that?
One way would be to change the URLConnetions to use my throttled streams but it would be great to access the socket used by the URLConnection itself.