2016-03-07 104 views
0

我正在使用最新的JBrowserDriver:https://github.com/MachinePublishers/jBrowserDriverJBrowserDriver主機名稱與主體提供的證書主體不匹配

我想消除「主機名'foobar'與主體提供的證書主題不匹配」異常。這是我做org.apache.http.HttpClient:

TrustStrategy trustStrategy = new TrustSelfSignedStrategy(); 
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStrategy).build(); 
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE; 

StatusLine statusLine; 
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(hostnameVerifier).build()) { 
    HttpGet httpGet = new HttpGet(deviceStatusURI); 
    ... 
} 

有沒有辦法做JBrowserDriver類似的東西?

回答

0

由於JBrowserDriver的版本爲0.10.2,您可以配置主機名是否經過驗證。要禁用驗證,請執行以下操作:

Settings settings = Settings.builder() 
     .hostnameVerification(false) 
     .build(); 
JBrowserDriver jBrowserDriver = new JBrowserDriver(settings); 
相關問題