Created
September 21, 2016 18:09
-
-
Save spockz/5b58937a6e7435a6e490d0cf72e5f651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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