PublicAccessLogHandlerTest.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:ambry 作者:
/**
 * Does a test to see that request handling results in expected entries in public access log
 * @param httpMethod the {@link HttpMethod} for the request.
 * @param uri Uri to be used during the request
 * @param testErrorCase true if error case has to be tested, false otherwise
 * @param useSSL {@code true} to test SSL logging.
 * @throws Exception
 */
private void doRequestHandleTest(HttpMethod httpMethod, String uri, boolean testErrorCase, boolean useSSL)
    throws Exception {
  EmbeddedChannel channel = createChannel(useSSL);
  List<HttpHeaders> httpHeadersList = getHeadersList();
  for (HttpHeaders headers : httpHeadersList) {
    HttpRequest request = RestTestUtils.createRequest(httpMethod, uri, headers);
    HttpUtil.setKeepAlive(request, true);
    sendRequestCheckResponse(channel, request, uri, headers, testErrorCase, false, useSSL);
    if (!testErrorCase) {
      Assert.assertTrue("Channel should not be closed ", channel.isOpen());
    } else {
      Assert.assertFalse("Channel should have been closed ", channel.isOpen());
      channel = createChannel(useSSL);
    }
  }
  channel.close();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号