Pass Through a Corporate Proxy in Java

Posted by in Software, Tutorial

TL;DR: There’s no easy way to create a proxy :) I’ve tried for a while to build a way to request something through a proxy, for testing an emulated android app. The solution came from Octavian who kindly provided me a snippet to run once per app lifetime. It tackles the problem from two fronts: Sets proxy system properties (http.proxy* and https.proxy*) Sets the default Authenticator The code is:

One thing that can be improved would be a configuration-based (e.g. defined environment variable) bypass code, rather than a hostname…read more

Inject Proxy Settings in Selenium/Chrome

Posted by in Software, Tutorial

I have the following situation: I’m behind a corporate proxy and I need to run a test accessing an external website. To do this, I’ve picked up chrome/chromium as driver of choice. My current solution implies an authentication via plugin. The plugin The chrome plugin is essentially 2 files: a manifest file a JS containing a listener Manifest The manifest file is:

The script Following script performs the proxy authentication:

,where the PROXY_* variables are the components of the proxy URL. Plugin The plugin is created by zipping…read more


Set Different Gradle Configurations

Posted by in IT, Tutorial

TL;DR: create a global file (in <HOME>/.gradle or GRADLE_USER_HOME if defined). Place there the system specific configuration. The other day I had the unpleasant surprise that Android Studio replicated my proxy settings into and got committed to Git. Including a password (which has since became obsolete). Since my other environment doesn’t use a proxy, I got an error there. Now, the question became: How do I create a single project gradle settings file which would allow me to run smoothly in both places? Although I thought of a…read more

Install and Use Package Control Behind Proxy

Posted by in IT, Tutorial

TL;DR: Install Package Control manually. Add the proxy settings to the configuration file as described in step 2 below. Today I’ve had to install Sublime Text 3 again on a new computer. Package control didn’t want to install due to my proxy settings (I was getting a 407 error code – Proxy authentification required). I managed to do it with two simple steps: Install Package Control manually. At the time of writing this post, the process is simple: Click the Preferences > Browse Packages… menu Browse up a folder and…read more

Set Up Concourse Behind a Proxy

Posted by in IT, Uncategorized

TL;DR: Most important thing is to find out if your proxy mangles/removes headers. If yes, then you need to contact your IT department. I’ve got the following error: Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Prerequisites In order to get Concourse CI working, you need to : Install VirtualBox and Install Vagrant in a directory without spaces (ruby bug) Now, you need to install the proxy plugin for Vagrant:

Then, initalise the install

Proxy configurations The vagrant proxy will allow you…read more

Gradle(w) and Proxy Authentication

Posted by in Software

The recent updates in Android Studio eliminate the possibility of passing JVM arguments to gradle. That’s quite unfortunate because I quite liked my solution and now I was getting a (not) nice Connection refused message… So I had to find a different solution. Environment Variable As always, everything related to Java can be configured via an environment variable. if you set GRADLE_OPTS, it’ll get passed to gradlew as JVM arguments. My GRADLE_OPTS looks like this now:

You should need to set up the https variants because downloads are made…read more

Gradle and Proxy Authentication in Android Studio

Posted by in Software

Update: This is obsolete as Android Studio is going to eliminate JVM arguments for gradle. See this post for a more future-proof approach. The other day I did an exercise to install Android Studio (“AS” henceforth) (0.8.4 at the moment of writing) and create a project with gradle in an environment with an authenticated proxy. It didn’t work out of the box, of course. Worse, it generated an exception (internal error). I found two solutions to make it work: Via configuration file JVM variables Configuration file When you create a…read more