Error when opening and closing an SSLSocket w/o writing any data

后端 未结 2 1629
青春惊慌失措
青春惊慌失措 2020-12-16 08:19

A simple server

listen = getServer();
Logger.getAnonymousLogger().info(\"Listening to \"+listen.toString());
SSLSocket client = (SSLSocket)listen.accept();
/         


        
2条回答
  •  庸人自扰
    2020-12-16 08:32

    The situation is invalid. You are trying to read data that isn't sent. This is an application protocol error. All the statements in Bruno's answer apply as well. The client is trying to do a handshake; the server is trying to close the connection. Arguably the server close could initiate a handshake if it hasn't been done already, but it doesn't.

    As you've noted, another workaround would be to call startHandshake() at either end.

提交回复
热议问题