Remote communication - e-ucm/ead GitHub Wiki
Network Proxy
Proxy detection
Discovering the existence of a proxy in a network in Java it is not an easy task. Some resources:
- Java 7 Networking and Proxies Documentation
- Proxy-vole (Proxy detection library)
- JDK-6370908 : Add support for HTTP_CONNECT proxy in Socket class
Testing proxy code
To facilitate the testing of the HTTP proxy-related code, it is recommended to follow these instructions in order to create simple testing environment. Bill of materials:
- VirtualBox
- Endian Firewall. Download the installation ISO.
Once VirtualBox is properly installed, it is necessary to create two VM:
- The Firewall / Proxy VM using the Endian Firewall installation iso.
- A client VM (Windows/Linux/MacOSX) that will be the VM where the code to test will be run.
Endian Firewall VM
Recommended VM settings for Endian Firewall (EFW) 2.5.2
- Type: Linux (Generic) 32-bit
- System: 512MB RAM; 1 VCPU; HD 8 GB (growable, in my installation only ~2GB are used)
- Network (this is the most important configuration): 2 adapters are needed.
- Adapter 1: Type="internal network"; name="intnet". This will be the GREEN adapter. This adapter and the network adapter of the client machine will be connected in this very same network, hence EFW will act as a NAT / proxy for the client VM.
- Adapter 2: Type=NAT. This will be the RED adapter. This adapter will be used by the EFW to be connected to internet.
Once the basic EFW installation is done then it is needed to login to the web interface and make the following configuration:
- Basic Network configuration.
- Proxy configuration: Enable the Proxy "not transparent" and make sure that the a port is configured for the proxy, typically it is 8080.
Client VM
- Type: N/A
- System: N/A
- Network (this is the only parameter that need attention): 1 adapter is needed.
- Adapter 1: type="internal network"; name="intnet" (actually the same name as the internal network of the EFW VM).
Proxy Settings for each specific OS:
- Linux (Ubuntu / CentOS): For both there is a Network / Proxy Settings where it is possible to setup the IP and port of the EFW. Note that (at least for yum) the network configuration need also to be done through environment variables.
http_proxy=http://my.efw.proxy:8080/
https_proxy=http://my.efw.proxy:8080/
ftp_proxy=http://my.efw.proxy:8080/
no_proxy="localhost,127.0.0.1"
HTTP_PROXY=http://my.efw.proxy:8080/
HTTPS_PROXY=http://my.efw.proxy:8080/
FTP_PROXY=http://my.efw.proxy:8080/
NO_PROXY="localhost,127.0.0.1"
- Windows. It is needed to configure the Windows (IE) network settings. Control Panel > Network Settings > Connections > LAN configuration