@Test public void testInboundChainNoChanges() throws Exception { List<Interceptor> interceptors = new ArrayList<>(); MockInterceptor interceptor1 = new MockInterceptor(); MockInterceptor interceptor2 = new MockInterceptor(); interceptors.add(interceptor1); interceptors.add(interceptor2); EmbeddedChannel channel = new EmbeddedChannel( new ChannelDuplexHandler() { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { InterceptorChain chain = new InterceptorChain(ctx, interceptors, (ResourceRequest) msg); chain.fireInbound(); } } ); ResourceRequest request = new DefaultResourceRequest.Builder(RequestType.READ, new ResourcePath("/foo/bar")).build(); channel.writeInbound(request); ResourceRequest endRequest = (ResourceRequest) channel.readInbound(); assertThat(endRequest).isNotNull(); assertThat(interceptor1.requests()).hasSize(1); assertThat(interceptor1.requests()).contains(request); assertThat(interceptor2.requests()).hasSize(1); assertThat(interceptor2.requests()).contains(request); }
public void fireInbound() { this.direction = Direction.INBOUND; this.current = 0; fireCurrentInbound(); }
InterceptorChain { public void fireInbound() { this.direction = Direction.INBOUND; this.current = 0; fireCurrentInbound(); } }
InterceptorChain { public void fireInbound() { this.direction = Direction.INBOUND; this.current = 0; fireCurrentInbound(); } InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceRequest request);  InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceResponse response); }
InterceptorChain { public void fireInbound() { this.direction = Direction.INBOUND; this.current = 0; fireCurrentInbound(); } InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceRequest request);  InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceResponse response); ResourceRequest request(); ResourceResponse response(); void fireInbound(); void fireOutbound(); void forward(); void forward(ResourceRequest request); void forward(ResourceResponse response); void replyWith(ResourceResponse response); }
InterceptorChain { public void fireInbound() { this.direction = Direction.INBOUND; this.current = 0; fireCurrentInbound(); } InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceRequest request);  InterceptorChain(ChannelHandlerContext ctx, List<Interceptor> interceptors, ResourceResponse response); ResourceRequest request(); ResourceResponse response(); void fireInbound(); void fireOutbound(); void forward(); void forward(ResourceRequest request); void forward(ResourceResponse response); void replyWith(ResourceResponse response);  }