private static void prepareLocalIp(final File fileIn, final File fileOut) {
        // insert local IP at right spots
        BufferedReader in = null;
        BufferedWriter out = null;
        try {
            final String ipSource = "<IPSource>" + InetAddress.getLocalHost().getHostAddress() + "</IPSource>";
            final String ipDest = "<IPDestination>" + InetAddress.getLocalHost().getHostAddress() + "</IPDestination>";

            String line;

            in = new BufferedReader(new FileReader(fileIn));
            out = new BufferedWriter(new FileWriter(fileOut));
            while (in.ready()) {
                line = in.readLine().trim();
                if (line.equals(IP_SOURCE_TEMPLATE)) {
                    out.append(ipSource);
                } else if (line.equals(IP_DESTINATION_TEMPLATE)) {
                    out.append(ipDest);
                } else {
                    out.append(line);
                }
                out.newLine();
            }
        } catch (UnknownHostException ex) {
            fail("Cannot obtain local IP.");
        } catch (IOException ex) {
            fail("Failed to prepare file " + fileIn + " for comparison.");
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException ex) {
                    Logger.getLogger(HistoryTest.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            if (out != null) {
                try {
                    out.close();
                } catch (IOException ex) {
                    Logger.getLogger(HistoryTest.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }