@Test
public void testNonStrictResourceChecking() throws Exception {

  DateTime before = new DateTime(DateTimeZone.UTC);
  before = before.plus(2 * 60 * 60 * 1000L);
  String hostname = "signed.host.com";
  String path = "/path/to/resource";
  String rtmpResource = "rtmp://" + hostname + path;
  String httpResource = "http://" + hostname + path;
  String portResource = "rtmp://" + hostname + ":8080" + path;
  String differentHostnameResource = "rtmp://different.host.com" + path;
  Policy differentScheme = Policy.mkSimplePolicy(rtmpResource, before);
  String signature = PolicyUtils.getPolicySignature(differentScheme, key);
  String differentSchemeQueryString = ResourceRequest.ENCRYPTION_ID_KEY + "=default&" + ResourceRequest.POLICY_KEY + "="
          + PolicyUtils.toBase64EncodedPolicy(differentScheme) + "&" + ResourceRequest.SIGNATURE_KEY + "="
          + signature;
  assertEquals(Status.Ok, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, httpResource, properties, false).getStatus());
  assertEquals(Status.Forbidden, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, httpResource, properties, true).getStatus());
  assertEquals(Status.Ok, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, portResource, properties, false).getStatus());
  assertEquals(Status.Forbidden, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, portResource, properties, true).getStatus());
  assertEquals(Status.Ok, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, differentHostnameResource, properties, false).getStatus());
  assertEquals(Status.Forbidden, ResourceRequestUtil
          .resourceRequestFromQueryString(differentSchemeQueryString, clientIp, differentHostnameResource, properties, true).getStatus());
}