package com.watcher.car;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpClient {

  public void post(String data) {
    try {
      HttpURLConnection conn = openConnection("http://leetor.no-ip.org:8010/");
      conn.setDoOutput(true);
      OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
      wr.write(data);
      wr.flush();
      wr.close();

      if (conn.getResponseCode() != 200) {
        throw new RuntimeException("Failed to post data, http status: " + conn.getResponseCode());
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  private HttpURLConnection openConnection(String url) throws IOException {
    return (HttpURLConnection) (new URL(url).openConnection());
  }
}

@@ -19,16 +19,45 @@
 r.car;%0A%0A
+import android.util.Base64;%0A%0A
 import j
@@ -72,24 +72,24 @@
 OException;%0A
-
 import java.
@@ -168,16 +168,60 @@
 t.URL;%0A%0A
+import static android.util.Base64.DEFAULT;%0A%0A
 public c
@@ -283,16 +283,16 @@
   try %7B%0A
-
       Ht
@@ -363,16 +363,133 @@
 010/%22);%0A
+      conn.setRequestProperty(%22Authorization%22, %22Basic %22 + Base64.encodeToString(%22car:watcher%22.getBytes(), DEFAULT));%0A
       co

Use basic auth when posting data.