@Test public void setStatusTest() { for (ResponseStatus expectedResponseStatus : ResponseStatus.values()) { HttpRequest request = createRequestWithHeaders(HttpMethod.GET, TestingUri.SetStatus.toString()); request.headers().set(MockNettyMessageProcessor.STATUS_HEADER_NAME, expectedResponseStatus); HttpUtil.setKeepAlive(request, false); EmbeddedChannel channel = createEmbeddedChannel(); channel.writeInbound(request); channel.readOutbound(); assertFalse("Channel not closed on the server", channel.isActive()); } String metricName = MetricRegistry.name(NettyResponseChannel.class, "UnknownResponseStatusCount"); long metricCount = MockNettyMessageProcessor.METRIC_REGISTRY.getCounters().get(metricName).getCount(); assertEquals("Some of the ResponseStatus codes were not recognized", 0, metricCount); }
@Override public void setStatus(ResponseStatus status) throws RestServiceException { responseMetadata.setStatus(getHttpResponseStatus(status)); responseStatus = status; logger.trace("Set status to {} for response on channel {}", responseMetadata.status(), ctx.channel()); }
NettyResponseChannel implements RestResponseChannel { @Override public void setStatus(ResponseStatus status) throws RestServiceException { responseMetadata.setStatus(getHttpResponseStatus(status)); responseStatus = status; logger.trace("Set status to {} for response on channel {}", responseMetadata.status(), ctx.channel()); } }
NettyResponseChannel implements RestResponseChannel { @Override public void setStatus(ResponseStatus status) throws RestServiceException { responseMetadata.setStatus(getHttpResponseStatus(status)); responseStatus = status; logger.trace("Set status to {} for response on channel {}", responseMetadata.status(), ctx.channel()); } NettyResponseChannel(ChannelHandlerContext ctx, NettyMetrics nettyMetrics, PerformanceConfig performanceConfig,
      NettyConfig nettyConfig); }
NettyResponseChannel implements RestResponseChannel { @Override public void setStatus(ResponseStatus status) throws RestServiceException { responseMetadata.setStatus(getHttpResponseStatus(status)); responseStatus = status; logger.trace("Set status to {} for response on channel {}", responseMetadata.status(), ctx.channel()); } NettyResponseChannel(ChannelHandlerContext ctx, NettyMetrics nettyMetrics, PerformanceConfig performanceConfig,
      NettyConfig nettyConfig); @Override Future<Long> write(ByteBuffer src, Callback<Long> callback); @Override Future<Long> write(ByteBuf src, Callback<Long> callback); @Override boolean isOpen(); @Override void close(); @Override void onResponseComplete(Exception exception); @Override void setStatus(ResponseStatus status); @Override ResponseStatus getStatus(); @Override void setHeader(String headerName, Object headerValue); @Override Object getHeader(String headerName); }
NettyResponseChannel implements RestResponseChannel { @Override public void setStatus(ResponseStatus status) throws RestServiceException { responseMetadata.setStatus(getHttpResponseStatus(status)); responseStatus = status; logger.trace("Set status to {} for response on channel {}", responseMetadata.status(), ctx.channel()); } NettyResponseChannel(ChannelHandlerContext ctx, NettyMetrics nettyMetrics, PerformanceConfig performanceConfig,
      NettyConfig nettyConfig); @Override Future<Long> write(ByteBuffer src, Callback<Long> callback); @Override Future<Long> write(ByteBuf src, Callback<Long> callback); @Override boolean isOpen(); @Override void close(); @Override void onResponseComplete(Exception exception); @Override void setStatus(ResponseStatus status); @Override ResponseStatus getStatus(); @Override void setHeader(String headerName, Object headerValue); @Override Object getHeader(String headerName); final ChannelFutureListener DELAYED_CLOSE; }