### Question:
RequestEnrichingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { return chain.proceed(enrich(request, chain.context())); } RequestEnrichingInterceptor(StyxHeaderConfig styxHeaderConfig); @Override Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain);  }### Answer:
@Test public void addsRequestIdToTheHeaders() { requestEnrichingInterceptor.intercept(get("/some-uri").build(), recording); assertThat(recording.recordedRequest().header(REQUEST_ID_DEFAULT), is(notNullValue())); }
@Test public void setsTheRemoteAddressToTheForwardedForList() { requestEnrichingInterceptor.intercept(get("").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_FOR), isValue("127.0.0.1")); }
@Test public void appendsTheRemoteAddressToTheForwardedForList() { requestEnrichingInterceptor.intercept(get("/some") .header(X_FORWARDED_FOR, "172.21.175.59").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_FOR), isValue("172.21.175.59, 127.0.0.1")); }
@Test public void addsXForwardedProtoToHttpWhenAbsent() { requestEnrichingInterceptor.intercept(get("/some").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_PROTO), isValue("http")); }
@Test public void addsXForwardedProtoToHttpsWhenAbsent() { requestEnrichingInterceptor.intercept(get("/some").build(), recordingSecure); assertThat(recordingSecure.recordedRequest().header(X_FORWARDED_PROTO), isValue("https")); }
@Test public void retainsXForwardedProtoWhenPresentInHttpMessage() { requestEnrichingInterceptor.intercept(get("/some").addHeader(X_FORWARDED_PROTO, "https").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_PROTO), isValue("https")); requestEnrichingInterceptor.intercept(get("/some").addHeader(X_FORWARDED_PROTO, "http").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_PROTO), isValue("http")); }
@Test public void retainsXForwardedProtoWhenPresentInHttpsMessage() { requestEnrichingInterceptor.intercept(get("/some").addHeader(X_FORWARDED_PROTO, "http").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_PROTO), isValue("http")); requestEnrichingInterceptor.intercept(get("/some").addHeader(X_FORWARDED_PROTO, "https").build(), recording); assertThat(recording.recordedRequest().header(X_FORWARDED_PROTO), isValue("https")); }