在Java中恢复TLS连接 [英] Resume TLS connection in Java
问题描述
我正在研究Java TLS客户端,服务器将经常进行通信。我知道协商TLS连接非常耗费资源和时间。我在 GnuTLS <中找到了一个非常有趣的解决方案/ A>。我感兴趣的是可以创建具有恢复功能的Java TLS客户端 - 使用先前协商的数据建立新连接。
I'm working on Java TLS client and server witch will communicate frequently. I know that negotiating TLS connection is very resource and time consuming. I found one very interesting solution in GnuTLS. I'm interested is it possible to create Java TLS Client with resume capability - establish a new connection using the previously negotiated data.
祝福
推荐答案
只要您使用相同的SSLSocketFactory创建套接字,如果会话仍然有效,Java中的JSSE实现将自动恢复现有会话。
As long as you use the same SSLSocketFactory to create the sockets, the JSSE implementation in Java will automatically resume an existing session, if the session is still valid.
您可以通过调用 SSLSocket.getSession()。getId()
来验证这一点,并检查是否有两个不同的套接字使用相同的会话。
You can verify this by invoking SSLSocket.getSession().getId()
and check if two different sockets are using the same session.
这篇关于在Java中恢复TLS连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!