Properly closing SSLSocket

前端 未结 3 1980
离开以前
离开以前 2020-11-30 09:41

I want to implement an SSL proxy in Java. I basically open two sockets browser-proxy,proxy-server, and run two threads which would write to p

3条回答
  •  感情败类
    2020-11-30 10:07

    In order to solve your problem you have to do the following:

    OutputStream sockOutOStream = sockout.getOutputStream();
    sockOutOStream.write(new byte[0]);
    sockOutOStream.flush();
    sockout.close();
    

    On the other end the party which reads from the socket will receive the -1-length message instead of SocketException thrown.

提交回复
热议问题