title: Error when opening and closing an SSLSocket w/o writing any data
body: <p>A simple server</p>
  
  <pre><code>listen = getServer();
  Logger.getAnonymousLogger().info("Listening to "+listen.toString());
  SSLSocket client = (SSLSocket)listen.accept();
  // adding this line fixes everything - client.write(42);
  client.close();
  </code></pre>
  
  <p>and a simple client</p>
  
  <pre><code>SocketFactory sockMaker = SSLSocketFactory.getDefault();
  Socket server = sockMaker.createSocket("localhost", 1443);
  int retval = server.getInputStream().read();
  assert retval == -1;
  server.close();
  </code></pre>
  
  <p>If I don't write anything to the SSL Socket, an exception is thrown in the client side:</p>
  
  <pre><code>Exception in thread "main" javax.net.ssl.SSLException:\
    Received close_notify during handshake
  at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
  </code></pre>
  
  <p>I don't see why is that. Does the SSL/TLS specification requires you to write things into the socket?</p>
  
  <p>See the <a href="https://github.com/elazarl/EmptyJavaSSL" rel="nofollow">full example</a>.</p>