code: static IOException ioeToSocketException(IOException ioe) {
      if (ioe.getClass().equals(IOException.class)) {
        // "se" could be a new class in stead of SocketException.
        IOException se = new SocketException("Original Exception : " + ioe);
        se.initCause(ioe);
        /* Change the stacktrace so that original trace is not truncated
         * when printed.*/ 
        se.setStackTrace(ioe.getStackTrace());
        return se;
      }
      // otherwise just return the same exception.
      return ioe;
    }
docs: Converts an IOExcpetion (not subclasses) to SocketException.
  This is typically done to indicate to upper layers that the error
  was a socket error rather than often more serious exceptions like
  disk errors.