B
BobSmith
How can I *sometimes* redirect a socket (created in a program I can not
change or extend) to go through a proxy server?
Changing the code that creates the socket is not possible, thus this
must be set up before the program is run (I run the program from within
my program, and in the same JVM).
Also, the key idea is to appear as if the requests are coming form
different computers, so different requests will need to be directed to
diferent proxy servers.
I was thinking replacing the SocketImplFactory using
Socket.setSocketImplFactory(new MySocketImplFactory);. I could send all
other requests for SocketImpl's back to the original SocketImplFactory
(thus not stuffing anything else up). My only remaining forseen problem
would be that I don't know how to make a SocketImpl, and I can't find
the original implementation of SocketImplFactory. (maybe its in com.sun
somewhere.... or in a inner class of Socket or ServerSocket or
something.....).
Any web searches on this topic return many sites about proxy servers
that have been writen in java, not about using proxy servers with java.
When I do find information about using a proxy in java, it is
invariably about using the system properties to set the http or ftp
proxies.
I haven't been thinking about this for very long, so there is probably
ALOT of things I haven't thought of.
change or extend) to go through a proxy server?
Changing the code that creates the socket is not possible, thus this
must be set up before the program is run (I run the program from within
my program, and in the same JVM).
Also, the key idea is to appear as if the requests are coming form
different computers, so different requests will need to be directed to
diferent proxy servers.
I was thinking replacing the SocketImplFactory using
Socket.setSocketImplFactory(new MySocketImplFactory);. I could send all
other requests for SocketImpl's back to the original SocketImplFactory
(thus not stuffing anything else up). My only remaining forseen problem
would be that I don't know how to make a SocketImpl, and I can't find
the original implementation of SocketImplFactory. (maybe its in com.sun
somewhere.... or in a inner class of Socket or ServerSocket or
something.....).
Any web searches on this topic return many sites about proxy servers
that have been writen in java, not about using proxy servers with java.
When I do find information about using a proxy in java, it is
invariably about using the system properties to set the http or ftp
proxies.
I haven't been thinking about this for very long, so there is probably
ALOT of things I haven't thought of.