Jan 132015
 

Big fan of Retrofit, but have a staging server that has an invalid SSL cert?

Fear not! Just use the AllCertsValidClient!

https://gist.github.com/loisaidasam/d4caf3659c8fa7a38222

Example usage:

Gson gson = new GsonBuilder()
    .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
    .create();
AllCertsValidClient client = new AllCertsValidClient();
RestAdapter restAdapter = new RestAdapter.Builder()
    .setEndpoint(host)
    .setConverter(new GsonConverter(gson))
    .setClient(client)
    .build();
service = restAdapter.create(MyApiService.class);

Have fun, and be safe! (don’t use this thing in production environments!)