Code example for HostnameVerifier

Methods: verify

0
        + "A6nxVgR/IjG69BmsBl92uFO7JTNtHztuiPqBn59pt+vNx4yPvno7zmxsfI7jv0ww\n" 
        + "yfs+0FNm7FwdsC1k47GBSOaGw38kuIVWqXSAbL4EX9GkryGGOKGNh0qvAENCdRSB\n" 
        + "G9Z6tyMbmfRY+dLSh3a9JwoEcBUso6EWYBakLbq4nG/nvYdYvG9ehrnLVwZFL82e\n" 
        + "l3Q/RK95bnA6cuRClGusLad0e6bjkBzx/VQ3VarDEpAkTLUGVAa0CLXtnyc=\n" 
        + "-----END CERTIFICATE-----\n"); 
    assertTrue(verifier.verify("foo.com", session));
    assertTrue(verifier.verify("www.foo.com", session));
    assertTrue(verifier.verify("\u82b1\u5b50.foo.com", session));
    assertFalse(verifier.verify("a.b.foo.com", session));
  } 
 
  @Test public void verifyWilcardCnOnTld() throws Exception { 
    // It's the CA's responsibility to not issue broad-matching certificates! 
    // CN=*.co.jp 
    SSLSession session = session(""
        + "-----BEGIN CERTIFICATE-----\n" 
        + "MIIERjCCAy6gAwIBAgIJAIz+EYMBU6aVMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD\n" 
        + "VQQGEwJDQTELMAkGA1UECBMCQkMxEjAQBgNVBAcTCVZhbmNvdXZlcjEWMBQGA1UE\n" 
        + "ChMNd3d3LmN1Y2JjLmNvbTEUMBIGA1UECxQLY29tbW9uc19zc2wxHTAbBgNVBAMU\n" 
        + "FGRlbW9faW50ZXJtZWRpYXRlX2NhMSUwIwYJKoZIhvcNAQkBFhZqdWxpdXNkYXZp\n" 
Stop searching for code, let great code find you!  Add Codota to your java IDE