import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;

import in.ashwanthkumar.slack.webhook.Slack;
import in.ashwanthkumar.slack.webhook.SlackMessage;

public class BenchmarkReporter {
	static Slack slack;

	static {
		String url = "https://hooks.slack.com/services/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";
		slack = new Slack(url).icon(":doomhappy:").sendToChannel("benchmark-notifs").displayName("Benchmark Reporter");
	}

	public static void reportReady() throws SocketException, IOException {
		slack.push(new SlackMessage("Benchmark Ready: " + getURL()));
	}

	static String getURL() throws SocketException {
		return "http://" + getIpAddress() + ":8080/diagrams";
	}

	static String getIpAddress() throws SocketException {
		System.setProperty("java.net.preferIPv4Stack", "true");
		Enumeration<NetworkInterface> n = NetworkInterface.getNetworkInterfaces();
		for (; n.hasMoreElements();) {
			NetworkInterface e = n.nextElement();
			if ("eth0".equals(e.getName())) {
				Enumeration<InetAddress> a = e.getInetAddresses();
				for (; a.hasMoreElements();) {
					InetAddress addr = a.nextElement();
					return addr.getHostAddress();
				}
			}
		}
		throw new RuntimeException("Could not retrieve IP address");
	}

}

@@ -8,27 +8,30 @@
 java.io.
-IOException
+BufferedReader
 ;%0D%0Aimpor
@@ -41,58 +41,57 @@
 ava.
-net.InetAddress;%0D%0Aimport java.net.NetworkInterface
+io.IOException;%0D%0Aimport java.io.InputStreamReader
 ;%0D%0Ai
@@ -105,31 +105,17 @@
 ava.net.
-SocketException
+*
 ;%0D%0Aimpor
@@ -820,423 +820,260 @@
 ss()
- throws SocketException %7B%0D%0A%09%09System.setProperty(%22java.net.preferIPv4Stack%22, %22true%22);%0D%0A%09%09Enumeration%3CNetworkInterface%3E n = NetworkInterface.getNetworkInterfaces();%0D%0A%09%09for (; n.hasMoreElements();) %7B%0D%0A%09%09%09NetworkInterface e = n.nextElement();%0D%0A%09%09%09if (%22eth0%22.equals(e.getN
+%7B%0D%0A%09%09String url = %22http://bot.whatismyipaddress.com%22;%0D%0A%09%09try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStre
 am
-e
 ()))
- 
+)
 %7B%0D%0A%09%09%09
-%09Enumeration%3CInetAddress%3E a = e.getInetAddresses();%0D%0A%09%09%09%09for (; a.hasMoreElements();) %7B%0D%0A%09%09%09%09%09InetAddress addr = a.nextElement
+return reader.readLine().trim();%0D%0A%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09e.printStackTrace
 ();%0D%0A%09%09%09
 %09%09re
@@ -1072,128 +1072,29 @@
 %0A%09%09%09
-%09
-%09
 return 
-addr.getHostAddress();%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09throw new RuntimeException(%22Could not retrieve IP address%22);
+%22%22;%0D%0A%09%09%7D
 %0D%0A%09%7D%0D%0A
-%0D%0A
 %7D%0D%0A
+%09

change benchmarkreporter ip getting method