All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zhttp.service.client.ClientSSLHandler.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC11
Show newest version
package zhttp.service.client

import io.netty.handler.ssl.util.InsecureTrustManagerFactory
import io.netty.handler.ssl.{SslContext, SslContextBuilder}

case object ClientSSLHandler {
  sealed trait ClientSSLOptions
  object ClientSSLOptions {
    case object DefaultSSL                             extends ClientSSLOptions
    final case class CustomSSL(sslContext: SslContext) extends ClientSSLOptions
  }
  def ssl(sslOption: ClientSSLOptions): SslContext = {
    sslOption match {
      case ClientSSLOptions.DefaultSSL            =>
        SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build()
      case ClientSSLOptions.CustomSSL(sslContext) => sslContext
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy