[英]Java + SSL using custom Socket
I'm developing a Java based P2P application where the peers are communicating with each using a library called ice4j and it's custom socket called PsuedoTCPSocket. 我正在开发一个基于Java的P2P应用程序,其中同级之间使用称为ice4j的库及其自定义套接字(称为PsuedoTCPSocket)进行通信。
I now want to add SSL support to the application. 我现在想向应用程序添加SSL支持。 PsuedoTCPSocket extends java.net.Socket so think it should possible to just use a SSLSocket on top of that socket.
PsuedoTCPSocket扩展了java.net.Socket,因此认为应该可以在该套接字之上使用SSLSocket。 However I'm not able to find any way to create SSLSocket-instances using a custom underlying Socket.
但是我找不到使用自定义基础Socket创建SSLSocket实例的任何方法。 Is this possible and if so how do I achieve it?
这可能吗,如果可以,我如何实现呢?
如果您的PseudoTCPSocket
扩展了java.net.Socket
(并且没有破坏其API),则应该能够使用SSLSocketFactory.createSocket(Socket s, String host, int port, boolean autoClose)
将其升级为SSLSocket
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.