Search in sources :

Example 1 with HttpHandler

use of com.hotels.styx.api.HttpHandler in project styx by ExpediaGroup.

the class StyxBackendServiceClientTest method hostHeaderIsNotOverwrittenWhenOverrideHostHeaderIsFalse.

@Test
public void hostHeaderIsNotOverwrittenWhenOverrideHostHeaderIsFalse() {
    HttpInterceptor.Context requestContext = requestContext();
    StyxHostHttpClient hostClient = mock(StyxHostHttpClient.class);
    HttpHandler httpHandler = mock(HttpHandler.class);
    Origin origin = newOriginBuilder(incomingHostname, 9090).applicationId(GENERIC_APP).build();
    RemoteHost remoteHost = remoteHost(origin, httpHandler, hostClient);
    LoadBalancer loadBalancer = mockLoadBalancer(Optional.of(remoteHost));
    when(httpHandler.handle(any(), any())).thenReturn(Eventual.of(testResponse));
    StyxBackendServiceClient styxHttpClient = new StyxBackendServiceClient.Builder(backendService.id()).originStatsFactory(mock(OriginStatsFactory.class)).originsRestrictionCookieName("someCookie").originIdHeader("origin-id").loadBalancer(loadBalancer).retryPolicy(new RetryNTimes(0)).metrics(metrics).overrideHostHeader(false).build();
    styxHttpClient.sendRequest(testRequest, requestContext);
    verify(httpHandler).handle(testRequest, requestContext);
}
Also used : Origin(com.hotels.styx.api.extension.Origin) RetryNTimes(com.hotels.styx.client.retry.RetryNTimes) Context(com.hotels.styx.api.HttpInterceptor.Context) HttpHandler(com.hotels.styx.api.HttpHandler) RemoteHost(com.hotels.styx.api.extension.RemoteHost) Origin.newOriginBuilder(com.hotels.styx.api.extension.Origin.newOriginBuilder) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) LoadBalancer(com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer) Test(org.junit.jupiter.api.Test)

Example 2 with HttpHandler

use of com.hotels.styx.api.HttpHandler in project styx by ExpediaGroup.

the class StyxBackendServiceClientTest method updatedRequestWithUpdatedHostHeaderIsPresentInResponseWhenOverrideHostHeaderIsTrue.

@Test
public void updatedRequestWithUpdatedHostHeaderIsPresentInResponseWhenOverrideHostHeaderIsTrue() {
    HttpInterceptor.Context requestContext = requestContext();
    StyxHostHttpClient hostClient = mock(StyxHostHttpClient.class);
    HttpHandler httpHandler = mock(HttpHandler.class);
    Origin origin = newOriginBuilder(updatedHostName, 9090).applicationId(GENERIC_APP).build();
    RemoteHost remoteHost = remoteHost(origin, httpHandler, hostClient);
    LoadBalancer loadBalancer = mockLoadBalancer(Optional.of(remoteHost));
    when(httpHandler.handle(any(), any())).thenReturn(Eventual.of(testResponse));
    StyxBackendServiceClient styxHttpClient = new StyxBackendServiceClient.Builder(backendService.id()).originStatsFactory(mock(OriginStatsFactory.class)).originsRestrictionCookieName("someCookie").originIdHeader("origin-id").loadBalancer(loadBalancer).retryPolicy(new RetryNTimes(0)).metrics(metrics).overrideHostHeader(true).build();
    Publisher<LiveHttpResponse> responsePublisher = styxHttpClient.sendRequest(testRequest, requestContext);
    StepVerifier.create(responsePublisher).expectNextMatches(it -> it.request().header(HttpHeaderNames.HOST).isPresent() && it.request().header(HttpHeaderNames.HOST).get().equals(updatedHostName)).verifyComplete();
}
Also used : Origin(com.hotels.styx.api.extension.Origin) RetryNTimes(com.hotels.styx.client.retry.RetryNTimes) BeforeEach(org.junit.jupiter.api.BeforeEach) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) StepVerifier(reactor.test.StepVerifier) LiveHttpResponse.response(com.hotels.styx.api.LiveHttpResponse.response) Processor(org.reactivestreams.Processor) Origin.newOriginBuilder(com.hotels.styx.api.extension.Origin.newOriginBuilder) RemoteHost.remoteHost(com.hotels.styx.api.extension.RemoteHost.remoteHost) Support.requestContext(com.hotels.styx.support.Support.requestContext) Context(com.hotels.styx.api.HttpInterceptor.Context) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) StickySessionConfig.stickySessionDisabled(com.hotels.styx.api.extension.service.StickySessionConfig.stickySessionDisabled) LiveHttpRequest.get(com.hotels.styx.api.LiveHttpRequest.get) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) BAD_REQUEST(com.hotels.styx.api.HttpResponseStatus.BAD_REQUEST) HttpHandler(com.hotels.styx.api.HttpHandler) OriginUnreachableException(com.hotels.styx.api.exceptions.OriginUnreachableException) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) HttpHeaderNames(com.hotels.styx.api.HttpHeaderNames) LoadBalancer(com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer) Test(org.junit.jupiter.api.Test) Matchers.any(org.mockito.Matchers.any) CHUNKED(com.hotels.styx.api.HttpHeaderNames.CHUNKED) CONTENT_LENGTH(com.hotels.styx.api.HttpHeaderNames.CONTENT_LENGTH) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) Mockito.inOrder(org.mockito.Mockito.inOrder) Origin(com.hotels.styx.api.extension.Origin) Optional(java.util.Optional) Matchers.is(org.hamcrest.Matchers.is) RequestCookie.requestCookie(com.hotels.styx.api.RequestCookie.requestCookie) Arrays.stream(java.util.Arrays.stream) Mockito.mock(org.mockito.Mockito.mock) RetryPolicy(com.hotels.styx.api.extension.retrypolicy.spi.RetryPolicy) GENERIC_APP(com.hotels.styx.api.Id.GENERIC_APP) StickySessionConfig(com.hotels.styx.api.extension.service.StickySessionConfig) NOT_IMPLEMENTED(com.hotels.styx.api.HttpResponseStatus.NOT_IMPLEMENTED) UNAUTHORIZED(com.hotels.styx.api.HttpResponseStatus.UNAUTHORIZED) TRANSFER_ENCODING(com.hotels.styx.api.HttpHeaderNames.TRANSFER_ENCODING) ArgumentCaptor(org.mockito.ArgumentCaptor) RetryNTimes(com.hotels.styx.client.retry.RetryNTimes) NoAvailableHostsException(com.hotels.styx.api.exceptions.NoAvailableHostsException) EmitterProcessor(reactor.core.publisher.EmitterProcessor) BackendService(com.hotels.styx.api.extension.service.BackendService) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Eventual(com.hotels.styx.api.Eventual) Matchers.empty(org.hamcrest.Matchers.empty) InOrder(org.mockito.InOrder) INTERNAL_SERVER_ERROR(com.hotels.styx.api.HttpResponseStatus.INTERNAL_SERVER_ERROR) Publisher(org.reactivestreams.Publisher) Matchers(org.hamcrest.Matchers) Mono(reactor.core.publisher.Mono) Mockito.when(org.mockito.Mockito.when) HostAndPort(com.google.common.net.HostAndPort) HttpResponseStatus(com.hotels.styx.api.HttpResponseStatus) RemoteHost(com.hotels.styx.api.extension.RemoteHost) Mockito.verify(org.mockito.Mockito.verify) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Flux(reactor.core.publisher.Flux) Mockito.never(org.mockito.Mockito.never) MeterRegistry(com.hotels.styx.api.MeterRegistry) OK(com.hotels.styx.api.HttpResponseStatus.OK) CentralisedMetrics(com.hotels.styx.metrics.CentralisedMetrics) Id(com.hotels.styx.api.Id) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) HttpHandler(com.hotels.styx.api.HttpHandler) Origin.newOriginBuilder(com.hotels.styx.api.extension.Origin.newOriginBuilder) LoadBalancer(com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) Context(com.hotels.styx.api.HttpInterceptor.Context) RemoteHost(com.hotels.styx.api.extension.RemoteHost) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Test(org.junit.jupiter.api.Test)

Example 3 with HttpHandler

use of com.hotels.styx.api.HttpHandler in project styx by ExpediaGroup.

the class StyxBackendServiceClientTest method originalRequestIsPresentInResponseWhenOverrideHostHeaderIsFalse.

@Test
public void originalRequestIsPresentInResponseWhenOverrideHostHeaderIsFalse() {
    HttpInterceptor.Context requestContext = requestContext();
    StyxHostHttpClient hostClient = mock(StyxHostHttpClient.class);
    HttpHandler httpHandler = mock(HttpHandler.class);
    Origin origin = newOriginBuilder(incomingHostname, 9090).applicationId(GENERIC_APP).build();
    RemoteHost remoteHost = remoteHost(origin, httpHandler, hostClient);
    LoadBalancer loadBalancer = mockLoadBalancer(Optional.of(remoteHost));
    when(httpHandler.handle(any(), any())).thenReturn(Eventual.of(testResponse));
    StyxBackendServiceClient styxHttpClient = new StyxBackendServiceClient.Builder(backendService.id()).originStatsFactory(mock(OriginStatsFactory.class)).originsRestrictionCookieName("someCookie").originIdHeader("origin-id").loadBalancer(loadBalancer).retryPolicy(new RetryNTimes(0)).metrics(metrics).overrideHostHeader(false).build();
    Publisher<LiveHttpResponse> responsePublisher = styxHttpClient.sendRequest(testRequest, requestContext);
    StepVerifier.create(responsePublisher).expectNextMatches(it -> it.request().header(HttpHeaderNames.HOST).isPresent() && it.request().header(HttpHeaderNames.HOST).get().equals(incomingHostname)).verifyComplete();
}
Also used : Origin(com.hotels.styx.api.extension.Origin) RetryNTimes(com.hotels.styx.client.retry.RetryNTimes) BeforeEach(org.junit.jupiter.api.BeforeEach) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) StepVerifier(reactor.test.StepVerifier) LiveHttpResponse.response(com.hotels.styx.api.LiveHttpResponse.response) Processor(org.reactivestreams.Processor) Origin.newOriginBuilder(com.hotels.styx.api.extension.Origin.newOriginBuilder) RemoteHost.remoteHost(com.hotels.styx.api.extension.RemoteHost.remoteHost) Support.requestContext(com.hotels.styx.support.Support.requestContext) Context(com.hotels.styx.api.HttpInterceptor.Context) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) StickySessionConfig.stickySessionDisabled(com.hotels.styx.api.extension.service.StickySessionConfig.stickySessionDisabled) LiveHttpRequest.get(com.hotels.styx.api.LiveHttpRequest.get) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) BAD_REQUEST(com.hotels.styx.api.HttpResponseStatus.BAD_REQUEST) HttpHandler(com.hotels.styx.api.HttpHandler) OriginUnreachableException(com.hotels.styx.api.exceptions.OriginUnreachableException) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) HttpHeaderNames(com.hotels.styx.api.HttpHeaderNames) LoadBalancer(com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer) Test(org.junit.jupiter.api.Test) Matchers.any(org.mockito.Matchers.any) CHUNKED(com.hotels.styx.api.HttpHeaderNames.CHUNKED) CONTENT_LENGTH(com.hotels.styx.api.HttpHeaderNames.CONTENT_LENGTH) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) Mockito.inOrder(org.mockito.Mockito.inOrder) Origin(com.hotels.styx.api.extension.Origin) Optional(java.util.Optional) Matchers.is(org.hamcrest.Matchers.is) RequestCookie.requestCookie(com.hotels.styx.api.RequestCookie.requestCookie) Arrays.stream(java.util.Arrays.stream) Mockito.mock(org.mockito.Mockito.mock) RetryPolicy(com.hotels.styx.api.extension.retrypolicy.spi.RetryPolicy) GENERIC_APP(com.hotels.styx.api.Id.GENERIC_APP) StickySessionConfig(com.hotels.styx.api.extension.service.StickySessionConfig) NOT_IMPLEMENTED(com.hotels.styx.api.HttpResponseStatus.NOT_IMPLEMENTED) UNAUTHORIZED(com.hotels.styx.api.HttpResponseStatus.UNAUTHORIZED) TRANSFER_ENCODING(com.hotels.styx.api.HttpHeaderNames.TRANSFER_ENCODING) ArgumentCaptor(org.mockito.ArgumentCaptor) RetryNTimes(com.hotels.styx.client.retry.RetryNTimes) NoAvailableHostsException(com.hotels.styx.api.exceptions.NoAvailableHostsException) EmitterProcessor(reactor.core.publisher.EmitterProcessor) BackendService(com.hotels.styx.api.extension.service.BackendService) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Eventual(com.hotels.styx.api.Eventual) Matchers.empty(org.hamcrest.Matchers.empty) InOrder(org.mockito.InOrder) INTERNAL_SERVER_ERROR(com.hotels.styx.api.HttpResponseStatus.INTERNAL_SERVER_ERROR) Publisher(org.reactivestreams.Publisher) Matchers(org.hamcrest.Matchers) Mono(reactor.core.publisher.Mono) Mockito.when(org.mockito.Mockito.when) HostAndPort(com.google.common.net.HostAndPort) HttpResponseStatus(com.hotels.styx.api.HttpResponseStatus) RemoteHost(com.hotels.styx.api.extension.RemoteHost) Mockito.verify(org.mockito.Mockito.verify) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Flux(reactor.core.publisher.Flux) Mockito.never(org.mockito.Mockito.never) MeterRegistry(com.hotels.styx.api.MeterRegistry) OK(com.hotels.styx.api.HttpResponseStatus.OK) CentralisedMetrics(com.hotels.styx.metrics.CentralisedMetrics) Id(com.hotels.styx.api.Id) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) HttpHandler(com.hotels.styx.api.HttpHandler) Origin.newOriginBuilder(com.hotels.styx.api.extension.Origin.newOriginBuilder) LoadBalancer(com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) Context(com.hotels.styx.api.HttpInterceptor.Context) RemoteHost(com.hotels.styx.api.extension.RemoteHost) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Test(org.junit.jupiter.api.Test)

Example 4 with HttpHandler

use of com.hotels.styx.api.HttpHandler in project styx by ExpediaGroup.

the class HttpStreamerTest method streamsRequestAndAggregatesResponses.

@Test
public void streamsRequestAndAggregatesResponses() {
    HttpHandler httpHandler = (request, ctx) -> Eventual.of(LiveHttpResponse.response(OK).body(ByteStream.from("abcdef", UTF_8)).build());
    HttpResponse response = Mono.from(new HttpStreamer(500, httpHandler).handle(HttpRequest.post("/").body("ABCDEF", UTF_8).build(), requestContext())).block();
    assertThat(response.bodyAs(UTF_8), is("abcdef"));
}
Also used : Eventual(com.hotels.styx.api.Eventual) HttpResponse(com.hotels.styx.api.HttpResponse) HttpHandler(com.hotels.styx.api.HttpHandler) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Mono(reactor.core.publisher.Mono) HttpRequest(com.hotels.styx.api.HttpRequest) Test(org.junit.jupiter.api.Test) Support.requestContext(com.hotels.styx.support.Support.requestContext) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) ByteStream(com.hotels.styx.api.ByteStream) OK(com.hotels.styx.api.HttpResponseStatus.OK) Matchers.is(org.hamcrest.Matchers.is) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HttpHandler(com.hotels.styx.api.HttpHandler) HttpResponse(com.hotels.styx.api.HttpResponse) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) Test(org.junit.jupiter.api.Test)

Example 5 with HttpHandler

use of com.hotels.styx.api.HttpHandler in project styx by ExpediaGroup.

the class HttpPipelineHandlerTest method mapsUnrecoverableInternalErrorsToInternalServerError500ResponseCode.

@Test
public void mapsUnrecoverableInternalErrorsToInternalServerError500ResponseCode() {
    HttpHandler handler = (request, context) -> {
        throw new RuntimeException("Forced exception for testing");
    };
    EmbeddedChannel channel = buildEmbeddedChannel(handlerWithMocks(handler));
    channel.writeInbound(httpRequestAsBuf(GET, "http://foo.com/"));
    DefaultHttpResponse response = (DefaultHttpResponse) channel.readOutbound();
    assertThat(response.status(), is(io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR));
    verify(responseEnhancer).enhance(any(LiveHttpResponse.Transformer.class), any(LiveHttpRequest.class));
    verify(errorListener, only()).proxyErrorOccurred(any(LiveHttpRequest.class), any(InetSocketAddress.class), eq(INTERNAL_SERVER_ERROR), any(RuntimeException.class));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) HttpResponse(com.hotels.styx.api.HttpResponse) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) LiveHttpResponse.response(com.hotels.styx.api.LiveHttpResponse.response) State(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State) ArgumentMatchers.nullable(org.mockito.ArgumentMatchers.nullable) REQUEST_TIMEOUT(com.hotels.styx.api.HttpResponseStatus.REQUEST_TIMEOUT) SENDING_RESPONSE(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.SENDING_RESPONSE) WARN(ch.qos.logback.classic.Level.WARN) TERMINATED(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.TERMINATED) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) Is.is(org.hamcrest.core.Is.is) LiveHttpRequest.get(com.hotels.styx.api.LiveHttpRequest.get) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) NettyToStyxRequestDecoder(com.hotels.styx.server.netty.codec.NettyToStyxRequestDecoder) BAD_REQUEST(com.hotels.styx.api.HttpResponseStatus.BAD_REQUEST) Mockito.only(org.mockito.Mockito.only) DecoderException(io.netty.handler.codec.DecoderException) HttpHandler(com.hotels.styx.api.HttpHandler) Gauge(io.micrometer.core.instrument.Gauge) SSLHandshakeException(javax.net.ssl.SSLHandshakeException) REQUEST_ENTITY_TOO_LARGE(com.hotels.styx.api.HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE) UtilKt.append(com.hotels.styx.javaconvenience.UtilKt.append) TooLongFrameException(io.netty.handler.codec.TooLongFrameException) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.jupiter.api.Test) Matchers.any(org.mockito.Matchers.any) List(java.util.List) CONTENT_LENGTH(com.hotels.styx.api.HttpHeaderNames.CONTENT_LENGTH) LiveHttpResponse(com.hotels.styx.api.LiveHttpResponse) DefaultHttpResponse(io.netty.handler.codec.http.DefaultHttpResponse) DO_NOT_MODIFY_RESPONSE(com.hotels.styx.server.netty.connectors.ResponseEnhancer.DO_NOT_MODIFY_RESPONSE) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Optional(java.util.Optional) HttpErrorStatusListener(com.hotels.styx.server.HttpErrorStatusListener) RequestTimeoutException(com.hotels.styx.server.RequestTimeoutException) ACCEPTING_REQUESTS(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.ACCEPTING_REQUESTS) Mockito.mock(org.mockito.Mockito.mock) WAITING_FOR_RESPONSE(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.WAITING_FOR_RESPONSE) LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IsEmptyCollection.empty(org.hamcrest.collection.IsEmptyCollection.empty) CompletableFuture(java.util.concurrent.CompletableFuture) Mockito.spy(org.mockito.Mockito.spy) Mockito.verifyZeroInteractions(org.mockito.Mockito.verifyZeroInteractions) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) LoggingEventMatcher.loggingEvent(com.hotels.styx.support.matchers.LoggingEventMatcher.loggingEvent) HttpMessageSupport.httpRequestAsBuf(com.hotels.styx.support.netty.HttpMessageSupport.httpRequestAsBuf) ArgumentCaptor(org.mockito.ArgumentCaptor) JustATestException(com.hotels.styx.support.JustATestException) EmitterProcessor(reactor.core.publisher.EmitterProcessor) CONNECTION(com.hotels.styx.api.HttpHeaderNames.CONNECTION) Matchers.anyObject(org.mockito.Matchers.anyObject) HttpResponseWriterFactory(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.HttpResponseWriterFactory) StyxClientException(com.hotels.styx.client.StyxClientException) CLOSE(com.hotels.styx.api.HttpHeaderValues.CLOSE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) RequestStatsCollector(com.hotels.styx.server.RequestStatsCollector) INFO(ch.qos.logback.classic.Level.INFO) Eventual(com.hotels.styx.api.Eventual) INTERNAL_SERVER_ERROR(com.hotels.styx.api.HttpResponseStatus.INTERNAL_SERVER_ERROR) GET(io.netty.handler.codec.http.HttpMethod.GET) UTF_8(java.nio.charset.StandardCharsets.UTF_8) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) BadRequestException(com.hotels.styx.server.BadRequestException) ChannelFuture(io.netty.channel.ChannelFuture) Mockito.verify(org.mockito.Mockito.verify) ContentOverflowException(com.hotels.styx.api.ContentOverflowException) HttpInterceptor(com.hotels.styx.api.HttpInterceptor) Channel(io.netty.channel.Channel) Flux(reactor.core.publisher.Flux) AfterEach(org.junit.jupiter.api.AfterEach) Mockito.never(org.mockito.Mockito.never) MeterRegistry(com.hotels.styx.api.MeterRegistry) SENDING_RESPONSE_CLIENT_CLOSED(com.hotels.styx.server.netty.connectors.HttpPipelineHandler.State.SENDING_RESPONSE_CLIENT_CLOSED) OK(com.hotels.styx.api.HttpResponseStatus.OK) CentralisedMetrics(com.hotels.styx.metrics.CentralisedMetrics) ChannelHandler(io.netty.channel.ChannelHandler) HttpRequestDecoder(io.netty.handler.codec.http.HttpRequestDecoder) HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) BAD_GATEWAY(com.hotels.styx.api.HttpResponseStatus.BAD_GATEWAY) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) HttpHandler(com.hotels.styx.api.HttpHandler) DefaultHttpResponse(io.netty.handler.codec.http.DefaultHttpResponse) LiveHttpRequest(com.hotels.styx.api.LiveHttpRequest) InetSocketAddress(java.net.InetSocketAddress) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Test(org.junit.jupiter.api.Test)

Aggregations

HttpHandler (com.hotels.styx.api.HttpHandler)23 Test (org.junit.jupiter.api.Test)20 LiveHttpRequest (com.hotels.styx.api.LiveHttpRequest)13 MeterRegistry (com.hotels.styx.api.MeterRegistry)11 MicrometerRegistry (com.hotels.styx.api.MicrometerRegistry)11 LiveHttpResponse (com.hotels.styx.api.LiveHttpResponse)10 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)9 Eventual (com.hotels.styx.api.Eventual)8 BackendService (com.hotels.styx.api.extension.service.BackendService)8 Registry (com.hotels.styx.api.extension.service.spi.Registry)8 HttpInterceptor (com.hotels.styx.api.HttpInterceptor)7 OK (com.hotels.styx.api.HttpResponseStatus.OK)6 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)6 Mono (reactor.core.publisher.Mono)6 LiveHttpRequest.get (com.hotels.styx.api.LiveHttpRequest.get)5 LiveHttpResponse.response (com.hotels.styx.api.LiveHttpResponse.response)5 Origin.newOriginBuilder (com.hotels.styx.api.extension.Origin.newOriginBuilder)5 Support.requestContext (com.hotels.styx.support.Support.requestContext)5 Arrays.asList (java.util.Arrays.asList)5 Matchers.is (org.hamcrest.Matchers.is)5