title: How should an InputStream and an OutputStream be closed?
body: <p>I'm using the following code to close an InputStream and an OutputStream from a connection to a server:</p>
  
  <pre><code>try {
          if (mInputStream != null) {
              mInputStream.close();
              mInputStream = null;
          }
  
          if (mOutputStream != null) {
              mOutputStream.close();
              mOutputStream = null;
          }
      } catch (IOException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>However, the streams are not closing, they are still alive.  If I connect again there are two different InputStreams.  No exception is being caught in the <code>catch</code> section.</p>
  
  <p>What am I doing wrong?</p>