Open Carmy85 opened 5 years ago
Hi,
You should configure netty's SslContext using ConnectorConfigurer
.
May be @kpavlov return to this good project
client = Iso8583Client(socketAddress, configuration, isoMessageFactory).apply {
configurer = object : ConnectorConfigurer<ClientConfiguration, Bootstrap> {
override fun configurePipeline(pipeline: ChannelPipeline, configuration: ClientConfiguration) {
super.configurePipeline(pipeline, configuration)
if (sslConnectionProps.enableSsl) {
LOGGER.debug("Инициализация ssl клиента")
val ctx = getSslContext(sslConnectionProps.useClientCert, false)
//SslContextBuilder.forClient().trustManager()
val handler = ctx.newHandler(pipeline.channel().alloc()).apply {
engine().needClientAuth = true
engine().wantClientAuth = true
engine().useClientMode = true
this.handshakeFuture().addListener { f ->
if (!f.isSuccess) LOGGER.error("Клиентский SSL handshake failed" + f.cause().message)
}
}
pipeline.addAfter("Iso8583ChannelInitializer#0", "SSLHandler#0", handler)
}
if (showHexDumpLogs) {
pipeline.addAfter("iso8583Decoder", "hexLog", LoggingHandler(LogLevel.DEBUG))
}
}
}
}
client.addMessageListener(ClientResponseMessageListener(channelsCache, jsonIsoConverter))
//client.configuration.replyOnError()=true
client.init();
client.connect()
It's possible to enable communications using protocols such as SSL / TLS ?
Thanks