Java NIO SSL - SSLEngine 会话重用

Java NIO SSL - SSLEngine Session reuse

我正在使用 Java 8 NIO 和 SSL 实现客户端和服务器部分。 我对创建 SSLEngine 有一些疑问。

SSLContext中有一个方法

public final SSLEngine createSSLEngine(String peerHost,
                                   int peerPort)

Applications using this factory method are providing hints for an internal session reuse strategy.

在客户端创建 SSLEngine 时,我必须提供服务器的 ip 和端口。 但是在服务器端创建 SSLEngine 时,我应该给哪个 IP 和端口?

根据 RFC2246,客户端必须在 ClientHello 消息中发送 "Session ID",服务器将检查其 "Session Cache" 是否匹配。 我如何告诉服务器的 SSLEngine 启用 "Session cache"?

While creating the SSLEngine at client side, I have to give server's ip and port. But while creating SSLEngine at server side, which IP and port I should give ?

客户的。

As per RFC2246, the client has to send "Session ID" in ClientHello Message, and Server will check its "Session Cache" for its match. How would I say to server's SSLEngine to enable "Session cache"?

默认开启,只要服务器端SSLEngine知道客户端IP:port。