4 package de
.ub0r
.android
.adBlock
;
6 import java
.io
.IOException
;
7 import java
.net
.ServerSocket
;
8 import java
.net
.Socket
;
10 import android
.app
.Service
;
11 import android
.content
.Intent
;
12 import android
.os
.IBinder
;
13 import android
.widget
.Toast
;
19 public class Proxy
extends Service
implements Runnable
{
21 private Thread proxy
= null;
22 private int port
= 8088;
23 private boolean stop
= false;
26 * @see android.app.Service#onBind(android.content.Intent)
29 public IBinder
onBind(Intent intent
) {
34 public void onStart(Intent intent
, int startId
) {
35 super.onStart(intent
, startId
);
37 Toast
.makeText(this, "starting proxy..", Toast
.LENGTH_LONG
).show();
38 proxy
= new Thread(this);
41 Toast
.makeText(this, "proxy running", Toast
.LENGTH_LONG
).show();
46 public void onDestroy() {
48 Toast
.makeText(this, "stopping proxy..", Toast
.LENGTH_LONG
).show();
55 ServerSocket sock
= new ServerSocket(this.port
);
59 client
= sock
.accept();
61 Thread t
= new Thread(new Connection(client
, this));
65 } catch (Exception e
) {
67 Toast
.makeText(this, e
.toString(), Toast
.LENGTH_LONG
).show();