Pretty sure there's a stack trace there though?
What happens on default settnigs – dont manually set the JVM default
context.

-- 
Konrad `ktoso` Malawski
Akka <http://akka.io> @ Lightbend <http://lightbend.com>

On 20 July 2016 at 14:13:39, Ajinkya Shukla (ajinkyashukl...@gmail.com)
wrote:

I get the following exception in DEBUG mode.

disconnected after javax.net.ssl.SSLHandshakeException: General SSLEngine
problem

On Wednesday, July 20, 2016 at 8:01:04 AM UTC-4, Ajinkya Shukla wrote:
>
> How can i make the following HTTPS request using akka-http to a jenkins
> server?
>
> curl -v -k --user "$USERNAME:$API_TOKEN" https://HOSTNAME.com/api/json
>
> The curl produces the following HTTPS request:
>
> Connected to HOST.com
> * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
> * Server certificate: Default Company Ltd
> * Server auth using Basic with user 'USERNAME'
> > GET /api/json HTTP/1.1
> > Host: HOSTNAME
> > Authorization: Basic API_TOKEN
> > User-Agent: curl/7.43.0
> > Accept: */*
>
> However I am not able to make the above request using akka-http. I get a
> SSL certificate error. Here is my code:
>
>
> import javax.net.ssl.SSLContext
>
> import akka.actor.{Actor, ActorLogging, ActorSystem}
> import akka.http.scaladsl.model._
> import akka.http.scaladsl.model.headers.{Authorization,
> BasicHttpCredentials}
> import akka.http.scaladsl.{Http, HttpsConnectionContext}
> import akka.stream.{ActorMaterializer, ActorMaterializerSettings,
> Materializer}
> import akka.util.ByteString
> import com.typesafe.sslconfig.akka.AkkaSSLConfig
> import com.typesafe.sslconfig.ssl.{SSLConfigSettings, SSLParametersConfig}
>
> import scala.concurrent.Future
>
> class Main extends Actor
>   with ActorLogging {
>
>   import akka.pattern.pipe
>   import context.dispatcher
>
>   implicit val system = ActorSystem("HelloSystem")
>
>   final implicit val materializer: ActorMaterializer =
> ActorMaterializer(ActorMaterializerSettings(context.system))
>
>   val modernHttpsConnectionContext: HttpsConnectionContext = new
> HttpsConnectionContext(
>     SSLContext.getDefault,
>     enabledProtocols = Some("TLSv1.2" :: "TLSv1.1" :: Nil)
>   )
>
>   class HttpClientSingleCustomHttps(connectionContext:
> HttpsConnectionContext)
>                                    (implicit val system: ActorSystem, val
> mat: Materializer) {
>     def sendHttpReq(req: HttpRequest): Future[HttpResponse] =
>       Http().singleRequest(req, connectionContext =
> connectionContext).pipeTo(self)
>   }
>
>   override def preStart() = {
>     log.info("Making request")
>     val client = new
> HttpClientSingleCustomHttps(modernHttpsConnectionContext)
>     val jenkinsRequest: HttpRequest = HttpRequest(
>       uri = "https://HOSTNAME.com/api/json";,
>       headers = List(
>         Authorization(BasicHttpCredentials("USERNAME","PASSWORD"))
>       )
>     )
>     client.sendHttpReq(jenkinsRequest)
>   }
>
>   def receive = {
>     case HttpResponse(StatusCodes.OK, headers, entity, _) =>
>       log.info("Got response, body: " +
> entity.dataBytes.runFold(ByteString(""))(_ ++ _))
>     case HttpResponse(code, _, _, _) =>
>       log.info("Request failed, response code: " + code)
>   }
>
> }
>
> --
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to