Skip to content

I need to use the GMSSL protocol #754

@jianwuzhao

Description

@jianwuzhao

Are you looking for help?

This is an issue tracker, used to manage and track the development of Play WS. It is not a support system and so it is not a place to ask questions or get help. If you're not sure if you have found a bug, the best place to start is with either the Play Discussion Forum or Stack Overflow.

Play WS Version (2.5.x / etc)

2.1.10

API (Scala / Java / Neither / Both)

Scala

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacBook-Pro.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

azul-1.8

Library Dependencies

If this is an issue that involves integration with another system, include the exact version and OS of the other system, including any intermediate drivers or APIs i.e. if you connect to a PostgreSQL database, include both the version / OS of PostgreSQL and the JDBC driver version used to connect to the database.
gmssl-https_2.13-2.0

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

val sslContext: SSLContext = configSSLContext.build()
private val builder: SslContextBuilder = SslContextBuilder.forClient()
builder.protocols(sslContext.getProtocol)

val config: AsyncHttpClientConfig = new DefaultAsyncHttpClientConfig.Builder()
.setSslEngineFactory(new JsseSslEngineFactory(sslContext))
.build()

lazy val wsClient: WSClient = {
val asyncHttpClient: AsyncHttpClient = new DefaultAsyncHttpClient(config)

new AhcWSClient(new StandaloneAhcWSClient(asyncHttpClient))

}

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

Be descriptive: "it doesn't work" does not describe what the behavior actually is -- instead, say "the page renders a 500 error code with no body content." Copy and paste logs, and include any URLs. Turn on internal Play WS logging with <logger name="play" value="TRACE"/> if there is no log output.

2023-04-11 09:58:40,770 [ERROR] from clients.Centre2Client in application-akka.actor.default-dispatcher-6 - register
java.net.ConnectException: not an SSL/TLS record: 160101004a0200004601016434bed02a6ec4295c98e2311abaad92265dfcfbab689598b2c504382fc9f9e1206565643164346536353331363436613338363936353936376665373764633131e0130016010103d80b0003d40003d10001e5308201e130820187a00302010202043db0ccc1300a06082a811ccf550183753056310b300906035504061302434e3111300f06035504080c085368616e674861693110300e06035504070c0742616f5368616e3111300f060355040a0c0854616c6c73616665310f300d060355040b0c06526f6f744341301e170d3233303131313038333632325a170d3234303131313038333632325a3047311330110603550403130a31302e302e302e32343431153013060355040b0c0c5348414e474841495f534d32310c300a060355040a1303485542310b300906035504061302434e3059301306072a8648ce3d020106082a811ccf5501822d03420004aa4ef8c00201baec3b47a3e832dc7347660205ce61b561a7ebfc8e66c001a409b33b1cd97a49f87191ea2014a5efe54397251442a921fd52027d47f37503aac3a3523050300e0603551d0f0101ff0404030205e0302a0603551d250101ff0420301e06082b0601050507030106082b0601050507030206082b0601050507030830120603551d110101ff0408300687040a0000f4300a06082a811ccf550183750348003045022100f95071cb9194df6936c371a45d51ab5ebb532b0cd8dcb2888f13275f5152cff40220749206204685686e345d70e359c48681d6cc430cbffc7e5cec5199e27f99d69d0001e6308201e230820187a003020102020424764fa5300a06082a811ccf550183753056310b300906035504061302434e3111300f06035504080c085368616e674861693110300e06035504070c0742616f5368616e3111300f060355040a0c0854616c6c73616665310f300d060355040b0c06526f6f744341301e170d3233303131313038333632325a170d3234303131313038333632325a3047311330110603550403130a31302e302e302e32343431153013060355040b0c0c5348414e474841495f534d32310c300a060355040a1303485542310b300906035504061302434e3059301306072a8648ce3d020106082a811ccf5501822d03420004037476b568414a9547fac0eff2d92b25ed94ebf5437a21326cb5a99b863b9a126af7af8da74fc0d022a0612a0c88781deded67d6d853fee7ffdd68e1d19876aba3523050300e0603551d0f0101ff040403020338302a0603551d250101ff0420301e06082b0601050507030106082b0601050507030206082b0601050507030830120603551d110101ff0408300687040a0000f4300a06082a811ccf550183750349003046022100c7460d97fb2fbc604fa1fd896e0840ee5dbfb1eb5e0dc9
	at play.shaded.ahc.org.asynchttpclient.netty.channel.NettyConnectListener.onFailure(NettyConnectListener.java:179)
	at play.shaded.ahc.org.asynchttpclient.netty.channel.NettyConnectListener$1.onFailure(NettyConnectListener.java:151)
	at play.shaded.ahc.org.asynchttpclient.netty.SimpleFutureListener.operationComplete(SimpleFutureListener.java:26)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:570)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:549)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)
	at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
	at play.shaded.ahc.io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1788)
	at play.shaded.ahc.io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1757)
	at play.shaded.ahc.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1203)
	at play.shaded.ahc.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1266)
	at play.shaded.ahc.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
	at play.shaded.ahc.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
	at play.shaded.ahc.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at play.shaded.ahc.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
	at play.shaded.ahc.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at play.shaded.ahc.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
	at play.shaded.ahc.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at play.shaded.ahc.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
	at play.shaded.ahc.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at play.shaded.ahc.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at play.shaded.ahc.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
	at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at play.shaded.ahc.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at play.shaded.ahc.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at play.shaded.ahc.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:750)
Caused by: play.shaded.ahc.io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 160101004a0200004601016434bed02a6ec4295c98e2311abaad92265dfcfbab689598b2c504382fc9f9e1206565643164346536353331363436613338363936353936376665373764633131e0130016010103d80b0003d40003d10001e5308201e130820187a00302010202043db0ccc1300a06082a811ccf550183753056310b300906035504061302434e3111300f06035504080c085368616e674861693110300e06035504070c0742616f5368616e3111300f060355040a0c0854616c6c73616665310f300d060355040b0c06526f6f744341301e170d3233303131313038333632325a170d3234303131313038333632325a3047311330110603550403130a31302e302e302e32343431153013060355040b0c0c5348414e474841495f534d32310c300a060355040a1303485542310b300906035504061302434e3059301306072a8648ce3d020106082a811ccf5501822d03420004aa4ef8c00201baec3b47a3e832dc7347660205ce61b561a7ebfc8e66c001a409b33b1cd97a49f87191ea2014a5efe54397251442a921fd52027d47f37503aac3a3523050300e0603551d0f0101ff0404030205e0302a0603551d250101ff0420301e06082b0601050507030106082b0601050507030206082b0601050507030830120603551d110101ff0408300687040a0000f4300a06082a811ccf550183750348003045022100f95071cb9194df6936c371a45d51ab5ebb532b0cd8dcb2888f13275f5152cff40220749206204685686e345d70e359c48681d6cc430cbffc7e5cec5199e27f99d69d0001e6308201e230820187a003020102020424764fa5300a06082a811ccf550183753056310b300906035504061302434e3111300f06035504080c085368616e674861693110300e06035504070c0742616f5368616e3111300f060355040a0c0854616c6c73616665310f300d060355040b0c06526f6f744341301e170d3233303131313038333632325a170d3234303131313038333632325a3047311330110603550403130a31302e302e302e32343431153013060355040b0c0c5348414e474841495f534d32310c300a060355040a1303485542310b300906035504061302434e3059301306072a8648ce3d020106082a811ccf5501822d03420004037476b568414a9547fac0eff2d92b25ed94ebf5437a21326cb5a99b863b9a126af7af8da74fc0d022a0612a0c88781deded67d6d853fee7ffdd68e1d19876aba3523050300e0603551d0f0101ff040403020338302a0603551d250101ff0420301e06082b0601050507030106082b0601050507030206082b0601050507030830120603551d110101ff0408300687040a0000f4300a06082a811ccf550183750349003046022100c7460d97fb2fbc604fa1fd896e0840ee5dbfb1eb5e0dc9
	at play.shaded.ahc.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1198)
	... 20 common frames omitted

But I can test it in other HTTP libraries, I don't know where the problem occurred

  "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.5.2",
  "com.softwaremill.sttp.client3" %% "async-http-client-backend-future" % "3.5.2"

Reproducible Test Case

Please provide a PR with a failing test.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions