public static HostRestrictingAuthorizationFilter
  initializeState(Configuration conf) {
    String confName = HostRestrictingAuthorizationFilter.HDFS_CONFIG_PREFIX +
        HostRestrictingAuthorizationFilter.RESTRICTION_CONFIG;
    String confValue = conf.get(confName);
    // simply pass a blank value if we do not have one set
    confValue = (confValue == null ? "" : confValue);

    Map<String, String> confMap =
        ImmutableMap.of(HostRestrictingAuthorizationFilter.RESTRICTION_CONFIG
            , confValue);
    FilterConfig fc =
        new DatanodeHttpServer.MapBasedFilterConfig(
            HostRestrictingAuthorizationFilter.class.getName(), confMap);
    HostRestrictingAuthorizationFilter hostRestrictingAuthorizationFilter =
        new HostRestrictingAuthorizationFilter();
    try {
      hostRestrictingAuthorizationFilter.init(fc);
    } catch (ServletException e) {
      throw new IllegalStateException(
          "Failed to initialize HostRestrictingAuthorizationFilter.", e);
    }
    return hostRestrictingAuthorizationFilter;
  }
@Test
  public void testMultipleAcceptedGETsOneChannel() {
    Configuration conf = new Configuration();
    conf.set(CONFNAME, "*,*,/allowed");
    HostRestrictingAuthorizationFilter filter =
        HostRestrictingAuthorizationFilterHandler.initializeState(conf);
    EmbeddedChannel channel = new CustomEmbeddedChannel("127.0.0.1", 1006,
        new HostRestrictingAuthorizationFilterHandler(filter));
    FullHttpRequest allowedHttpRequest =
        new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
            HttpMethod.GET,
            WebHdfsFileSystem.PATH_PREFIX + "/allowed/file_one?op=OPEN");
    FullHttpRequest allowedHttpRequest2 =
        new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
            HttpMethod.GET,
            WebHdfsFileSystem.PATH_PREFIX + "/allowed/file_two?op=OPEN");
    FullHttpRequest allowedHttpRequest3 =
        new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
            HttpMethod.GET,
            WebHdfsFileSystem.PATH_PREFIX + "/allowed/file_three?op=OPEN");
    assertTrue("Should successfully accept request",
        channel.writeInbound(allowedHttpRequest));
    assertTrue("Should successfully accept request, second time",
        channel.writeInbound(allowedHttpRequest2));
    assertTrue("Should successfully accept request, third time",
        channel.writeInbound(allowedHttpRequest3));
  }