as provided in docs and here, I was trying to change HostnameVerifierClass
using following code:
val sslConfig = AkkaSSLConfig().mapSettings { s =>
s.withHostnameVerifierClass(java.lang.Class[NoopHostnameVerifier])
s
}
val badCtx = Http().createClientHttpsContext(sslConfig)
Http().superPool[RequestTracker](badCtx)(httpMat)
But I am getting following error with this:
Error:(83, 31) object java.lang.Class is not a value s.withHostnameVerifierClass(JJClass[NoopHostnameVerifier])
Getting help from this answer, I changed it to:
val sslConfig = AkkaSSLConfig().mapSettings { s =>
s.withHostnameVerifierClass(classOf[NoopHostnameVerifier])
s
}
But this also does not compile saying:
Error:(83, 38) type mismatch;
found : Classorg.apache.http.conn.ssl.NoopHostnameVerifier
required: Class[javax.net.ssl.HostnameVerifier]
Note: org.apache.http.conn.ssl.NoopHostnameVerifier <: javax.net.ssl.HostnameVerifier, but Java-defined class Class is invariant in type T.
You may wish to investigate a wildcard type such as
_ <: javax.net.ssl.HostnameVerifier
. (SLS 3.2.10)s.withHostnameVerifierClass(classOf[NoopHostnameVerifier])
How do I get around this, NoopHostnameVerifier
implements interface HostnameVerifier
, but still this error coming.