Skip to content

Instantly share code, notes, and snippets.

@helmbold
helmbold / CarelessHttpsClient.scala
Last active August 3, 2018 03:50
Apache HTTP Client (version 4.5) that ignores certificate warnings/errors
import java.security.cert.X509Certificate
import org.apache.http.config.RegistryBuilder
import org.apache.http.conn.socket.{ConnectionSocketFactory, PlainConnectionSocketFactory}
import org.apache.http.conn.ssl.{NoopHostnameVerifier, SSLConnectionSocketFactory, TrustStrategy}
import org.apache.http.impl.client.{CloseableHttpClient, HttpClients}
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager
import org.apache.http.ssl.SSLContextBuilder
object CarelessHttpsClient {