Skip to content

Instantly share code, notes, and snippets.

View joshafeinberg's full-sized avatar

Josh Feinberg joshafeinberg

View GitHub Profile
@joshafeinberg
joshafeinberg / HostSelectionInterceptor.java
Last active September 26, 2016 16:30 — forked from swankjesse/HostSelectionInterceptor.java
This OkHttp application interceptor will replace the destination hostname in the request URL.
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/** An interceptor that allows runtime changes to the URL hostname. */
public final class HostSelectionInterceptor implements Interceptor {
private volatile String host;