title: java.net.SocketException: Connection reset
body: <p>I am coding an application where I control the code of both the client and the server.
  I am using SSLSockets to implement it.
  I have the protocol already running with normal unsecured sockets, but when I try to switch to SSLSockets (using exactly the same protocol), I keep getting the following stack trace:</p>
  
  <pre><code>java.net.SocketException: Connection reset
          at java.net.SocketInputStream.read(SocketInputStream.java:168)
          at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
          at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:782)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:739)
  </code></pre>
  
  <p>For some reason, the exact same code works perfectly with unsecured sockets. Why could this be?</p>
  
  <p>Any feedback would be appreciated. Thank you.</p>
  
  <p>Pablo</p>