Instantly share code, notes, and snippets.

Embed
What would you like to do?
object Foo {
def withTls(hostname: String, ciphers: Array[String]): Client = {
val socketAddressToEngine: SocketAddress => Engine = {
case sa: InetSocketAddress =>
val c = Ssl.client(hostname, sa.getPort)
c.self.setEnabledCipherSuites(ciphers)
c
case _ =>
val c = Ssl.client()
c.self.setEnabledCipherSuites(ciphers)
c
}
configured(Transport.TLSClientEngine(Some(socketAddressToEngine)))
.configured(Transporter.TLSHostname(Some(hostname)))
.configured(Transport.Tls(TlsConfig.ClientHostname(hostname)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment