libs/jstun-android.patch
author Nikita Kozlov <nikita@beem-project.com>
Sat, 03 Oct 2009 15:18:26 +0200
changeset 445 e1b29b86422c
permissions -rw-r--r--
ajout de la lib jstun et de son patch

diff -Nru src-stun/de/javawi/jstun/attribute/ChangedAddress.java src/de/javawi/jstun/attribute/ChangedAddress.java
--- src-stun/de/javawi/jstun/attribute/ChangedAddress.java	2009-03-08 13:37:27.000000000 +0100
+++ src/de/javawi/jstun/attribute/ChangedAddress.java	2009-10-03 14:47:30.504972058 +0200
@@ -11,11 +11,9 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 public class ChangedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
-	private static final Logger LOGGER = LoggerFactory.getLogger(ChangedAddress.class);
 	
 	public ChangedAddress() {
 		super(MessageAttribute.MessageAttributeType.ChangedAddress);
@@ -24,7 +22,7 @@
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
 		ChangedAddress ca = new ChangedAddress();
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ca, data);
-		LOGGER.debug("Message Attribute: Changed Address parsed: " + ca.toString() + ".");
+		Log.d("Jstun-ChangedAddress", "Message Attribute: Changed Address parsed: " + ca.toString() + ".");
 		return ca;
 	}
 }
diff -Nru src-stun/de/javawi/jstun/attribute/MappedAddress.java src/de/javawi/jstun/attribute/MappedAddress.java
--- src-stun/de/javawi/jstun/attribute/MappedAddress.java	2009-03-08 13:36:42.000000000 +0100
+++ src/de/javawi/jstun/attribute/MappedAddress.java	2009-10-03 14:47:23.989081351 +0200
@@ -11,11 +11,9 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 public class MappedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
-	private static final Logger LOGGER = LoggerFactory.getLogger(MappedAddress.class);
 	public MappedAddress() {
 		super(MessageAttribute.MessageAttributeType.MappedAddress);
 	}
@@ -23,7 +21,7 @@
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
 		MappedAddress ma = new MappedAddress();
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ma, data);
-		LOGGER.debug("Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
+		Log.d("Jstun-MappedAddress", "Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
 		return ma;
 	}
 }
diff -Nru src-stun/de/javawi/jstun/attribute/MessageAttribute.java src/de/javawi/jstun/attribute/MessageAttribute.java
--- src-stun/de/javawi/jstun/attribute/MessageAttribute.java	2009-03-08 13:35:52.000000000 +0100
+++ src/de/javawi/jstun/attribute/MessageAttribute.java	2009-10-03 14:48:48.776972620 +0200
@@ -11,15 +11,12 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import android.util.Log;
 import de.javawi.jstun.util.Utility;
 import de.javawi.jstun.util.UtilityException;
 
 
 public abstract class MessageAttribute implements MessageAttributeInterface {
-	private static final Logger LOGGER = LoggerFactory.getLogger(MessageAttribute.class);
 	MessageAttributeType type;
 	
 	public MessageAttribute() {
@@ -104,7 +101,7 @@
 				if (type <= 0x7fff) {
 					throw new UnknownMessageAttributeException("Unkown mandatory message attribute", intToType(type));
 				} else {
-					LOGGER.debug("MessageAttribute with type " + type + " unkown.");
+					Log.d("Jstun-MessageAttribute", "MessageAttribute with type " + type + " unkown.");
 					ma = Dummy.parse(valueArray);
 					break;
 				}
diff -Nru src-stun/de/javawi/jstun/attribute/ReflectedFrom.java src/de/javawi/jstun/attribute/ReflectedFrom.java
--- src-stun/de/javawi/jstun/attribute/ReflectedFrom.java	2009-03-08 13:34:16.000000000 +0100
+++ src/de/javawi/jstun/attribute/ReflectedFrom.java	2009-10-03 14:48:06.624977962 +0200
@@ -11,11 +11,9 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 public class ReflectedFrom extends MappedResponseChangedSourceAddressReflectedFrom {
-	private static final Logger LOGGER = LoggerFactory.getLogger(ReflectedFrom.class);
 	
 	public ReflectedFrom() {
 		super(MessageAttribute.MessageAttributeType.ReflectedFrom);
@@ -24,7 +22,7 @@
 	public static ReflectedFrom parse(byte[] data) throws MessageAttributeParsingException {
 		ReflectedFrom result = new ReflectedFrom();
 		MappedResponseChangedSourceAddressReflectedFrom.parse(result, data);
-		LOGGER.debug("Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
+		Log.d("Jstun-ReflectedFrom", "Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
 		return result;
 	}
 
diff -Nru src-stun/de/javawi/jstun/attribute/ResponseAddress.java src/de/javawi/jstun/attribute/ResponseAddress.java
--- src-stun/de/javawi/jstun/attribute/ResponseAddress.java	2009-03-08 13:35:02.000000000 +0100
+++ src/de/javawi/jstun/attribute/ResponseAddress.java	2009-10-03 14:49:42.388979100 +0200
@@ -11,12 +11,9 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import android.util.Log;
 
 public class ResponseAddress extends MappedResponseChangedSourceAddressReflectedFrom {
-	private static final Logger LOGGER = LoggerFactory.getLogger(ResponseAddress.class);
 	public ResponseAddress() {
 		super(MessageAttribute.MessageAttributeType.ResponseAddress);
 	}
@@ -24,7 +21,7 @@
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
 		ResponseAddress ra = new ResponseAddress();
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ra, data);
-		LOGGER.debug("Message Attribute: Response Address parsed: " + ra.toString() + ".");
+		Log.d("Jstun-ResponseAddress", "Message Attribute: Response Address parsed: " + ra.toString() + ".");
 		return ra;
 	}
 }
diff -Nru src-stun/de/javawi/jstun/attribute/SourceAddress.java src/de/javawi/jstun/attribute/SourceAddress.java
--- src-stun/de/javawi/jstun/attribute/SourceAddress.java	2009-03-08 13:33:15.000000000 +0100
+++ src/de/javawi/jstun/attribute/SourceAddress.java	2009-10-03 14:50:35.312972305 +0200
@@ -11,12 +11,9 @@
 
 package de.javawi.jstun.attribute;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import android.util.Log;
 
 public class SourceAddress extends MappedResponseChangedSourceAddressReflectedFrom {
-	private static final Logger LOGGER = LoggerFactory.getLogger(SourceAddress.class);
 	public SourceAddress() {
 		super(MessageAttribute.MessageAttributeType.SourceAddress);
 	}
@@ -24,7 +21,7 @@
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
 		SourceAddress sa = new SourceAddress();
 		MappedResponseChangedSourceAddressReflectedFrom.parse(sa, data);
-		LOGGER.debug("Message Attribute: Source Address parsed: " + sa.toString() + ".");
+		Log.d("Jstun-SourceAddress", "Message Attribute: Source Address parsed: " + sa.toString() + ".");
 		return sa;
 	}
 }
\ No newline at end of file
diff -Nru src-stun/de/javawi/jstun/header/MessageHeader.java src/de/javawi/jstun/header/MessageHeader.java
--- src-stun/de/javawi/jstun/header/MessageHeader.java	2009-03-08 13:54:30.000000000 +0100
+++ src/de/javawi/jstun/header/MessageHeader.java	2009-10-03 14:52:58.156973579 +0200
@@ -14,8 +14,7 @@
 import java.util.Iterator;
 import java.util.TreeMap;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 import de.javawi.jstun.attribute.MessageAttribute;
 import de.javawi.jstun.attribute.MessageAttributeParsingException;
@@ -38,7 +37,6 @@
      *                                                                 |
      * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 */
-	private static final Logger LOGGER = LoggerFactory.getLogger(MessageHeader.class);
 	MessageHeaderType type;
 	byte[] id = new byte[16];
 	
@@ -169,12 +167,12 @@
 			System.arraycopy(data, 0, typeArray, 0, 2);
 			int type = Utility.twoBytesToInteger(typeArray);
 			switch (type) {
-				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); LOGGER.debug("Binding Request received."); break;
-				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); LOGGER.debug("Binding Response received."); break;
-				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); LOGGER.debug("Binding Error Response received."); break;
-				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); LOGGER.debug("Shared Secret Request received."); break;
-				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); LOGGER.debug("Shared Secret Response received."); break;
-				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); LOGGER.debug("Shared Secret Error Response received.");break;
+				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); Log.d("Jstun-MessageHeader", "Binding Request received."); break;
+				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); Log.d("Jstun-MessageHeader", "Binding Response received."); break;
+				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); Log.d("Jstun-MessageHeader", "Binding Error Response received."); break;
+				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); Log.d("Jstun-MessageHeader", "Shared Secret Request received."); break;
+				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); Log.d("Jstun-MessageHeader", "Shared Secret Response received."); break;
+				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); Log.d("Jstun-MessageHeader", "Shared Secret Error Response received.");break;
 				default: throw new MessageHeaderParsingException("Message type " + type + "is not supported"); 
 			}
 			return mh;
diff -Nru src-stun/de/javawi/jstun/test/BindingLifetimeTest.java src/de/javawi/jstun/test/BindingLifetimeTest.java
--- src-stun/de/javawi/jstun/test/BindingLifetimeTest.java	2009-03-08 13:43:27.000000000 +0100
+++ src/de/javawi/jstun/test/BindingLifetimeTest.java	2009-10-03 14:55:31.104990854 +0200
@@ -21,8 +21,8 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
+
 
 import de.javawi.jstun.attribute.ChangeRequest;
 import de.javawi.jstun.attribute.ErrorCode;
@@ -36,7 +36,6 @@
 import de.javawi.jstun.util.UtilityException;
 
 public class BindingLifetimeTest {
-	private static final Logger LOGGER = LoggerFactory.getLogger(BindingLifetimeTest.class);
 	String stunServer;
 	int port;
 	int timeout = 300; //ms
@@ -70,7 +69,7 @@
 		}
 		BindingLifetimeTask task = new BindingLifetimeTask();
 		timer.schedule(task, binarySearchLifetime);
-		LOGGER.debug("Timer scheduled initially: " + binarySearchLifetime + ".");
+		Log.d("Jstun-BindingLifetimeTest", "Timer scheduled initially: " + binarySearchLifetime + ".");
 	}
 	
 	private boolean bindingCommunicationInitialSocket() throws UtilityException, IOException, MessageHeaderParsingException, MessageAttributeParsingException {
@@ -82,7 +81,7 @@
 		
 		DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
 		initialSocket.send(send);
-		LOGGER.debug("Binding Request sent.");
+		Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
 	
 		MessageHeader receiveMH = new MessageHeader();
 		while (!(receiveMH.equalTransactionID(sendMH))) {
@@ -94,11 +93,11 @@
 		ma = (MappedAddress) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.MappedAddress);
 		ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 		if (ec != null) {
-			LOGGER.debug("Message header contains an Errorcode message attribute.");
+			Log.d("Jstun-BindingLifetimeTest", "Message header contains an Errorcode message attribute.");
 			return true;
 		}
 		if (ma == null) {
-			LOGGER.debug("Response does not contain a Mapped Address message attribute.");
+			Log.d("Jstun-BindingLifetimeTest", "Response does not contain a Mapped Address message attribute.");
 			return true;
 		}
 		return false;
@@ -127,7 +126,7 @@
 			try {
 				lifetimeQuery();
 			} catch (Exception e) {
-				LOGGER.debug("Unhandled Exception. BindLifetimeTasks stopped.");
+				Log.d("Jstun-BindingLifetimeTest", "Unhandled Exception. BindLifetimeTasks stopped.");
 				e.printStackTrace();
 			}
 		}
@@ -150,7 +149,7 @@
 			
 				DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
 				socket.send(send);
-				LOGGER.debug("Binding Request sent.");
+				Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
 		
 				MessageHeader receiveMH = new MessageHeader();
 				while (!(receiveMH.equalTransactionID(sendMH))) {
@@ -161,30 +160,30 @@
 				}
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 				if (ec != null) {
-					LOGGER.debug("Message header contains errorcode message attribute.");
+					Log.d("Jstun-BindingLifetimeTest", "Message header contains errorcode message attribute.");
 					return;
 				}
-				LOGGER.debug("Binding Response received.");
+				Log.d("Jstun-BindingLifetimeTest", "Binding Response received.");
 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
-					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
 					completed = true;
 					return;
 				}
 				lifetime = binarySearchLifetime;
-				LOGGER.debug("Lifetime update: " + lifetime + ".");
+				Log.d("Jstun-BindingLifetimeTest", "Lifetime update: " + lifetime + ".");
 				lowerBinarySearchLifetime = binarySearchLifetime;
 				binarySearchLifetime = (upperBinarySearchLifetime + lowerBinarySearchLifetime) / 2;
 				if (binarySearchLifetime > 0) {
 					BindingLifetimeTask task = new BindingLifetimeTask();
 					timer.schedule(task, binarySearchLifetime);
-					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
 				} else {
 					completed = true;
 				}
 			} catch (SocketTimeoutException ste) {
-				LOGGER.debug("Read operation at query socket timeout.");
+				Log.d("Jstun-BindingLifetimeTest", "Read operation at query socket timeout.");
 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
-					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
 					completed = true;
 					return;
 				}
@@ -196,7 +195,7 @@
 					}
 					BindingLifetimeTask task = new BindingLifetimeTask();
 					timer.schedule(task, binarySearchLifetime);
-					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
 				} else {
 					completed = true;
 				}
diff -Nru src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java src/de/javawi/jstun/test/demo/ice/ICENegociator.java
--- src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-03-08 13:40:52.000000000 +0100
+++ src/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-10-03 14:57:51.400971966 +0200
@@ -23,9 +23,7 @@
 import java.util.List;
 import java.util.Vector;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import android.util.Log;
 import de.javawi.jstun.attribute.MessageAttributeException;
 import de.javawi.jstun.header.MessageHeaderParsingException;
 import de.javawi.jstun.test.DiscoveryInfo;
@@ -35,7 +33,6 @@
 import de.javawi.jstun.util.UtilityException;
 
 public class ICENegociator {
-	private static final Logger LOGGER = LoggerFactory.getLogger(ICENegociator.class);
 	// type preference must be an integer from 0 (=lowest) to 126 (=highest) (inclusive)
 	private final static int LOCAL_PREFERENCE = 0;
 	private final static int SERVER_REFLEXIVE_PREFERENCE = 42;
@@ -91,29 +88,29 @@
 								candidates.add(cand);
 							}
 						} catch (MessageHeaderParsingException mhpe) {
-							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
 							mhpe.printStackTrace();
 						} catch (MessageAttributeException mae) {
-							LOGGER.debug("MessageAttributeException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "MessageAttributeException while gathering candidate addresses.");
 							mae.printStackTrace();	
 						} catch (UtilityException ue) {
-							LOGGER.debug("UtilityException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "UtilityException while gathering candidate addresses.");
 							ue.printStackTrace();
 						} catch (UnknownHostException uhe) {
-							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
 							uhe.printStackTrace();
 						} catch (SocketException se) {
-							LOGGER.debug("SocketException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "SocketException while gathering candidate addresses.");
 							se.printStackTrace();
 						} catch (IOException ioe) {
-							LOGGER.debug("IOException while gathering candidate addresses.");
+							Log.d("Jstun-ICENegociator", "IOException while gathering candidate addresses.");
 							ioe.printStackTrace();
 						}
 					}
 				}
 			}
 		} catch (SocketException se) {
-			LOGGER.debug("SocketException while enumatering over the network cards.");
+			Log.d("Jstun-ICENegociator", "SocketException while enumatering over the network cards.");
 			se.printStackTrace();
 		}
 	}
diff -Nru src-stun/de/javawi/jstun/test/demo/StunServer.java src/de/javawi/jstun/test/demo/StunServer.java
--- src-stun/de/javawi/jstun/test/demo/StunServer.java	2009-03-08 13:52:00.000000000 +0100
+++ src/de/javawi/jstun/test/demo/StunServer.java	2009-10-03 14:57:05.248972557 +0200
@@ -23,8 +23,7 @@
 import java.util.logging.Level;
 import java.util.logging.SimpleFormatter;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 import de.javawi.jstun.attribute.ChangeRequest;
 import de.javawi.jstun.attribute.ChangedAddress;
@@ -47,7 +46,6 @@
  * The server requires a machine that is dual-homed to be functional. 
  */
 public class StunServer {
-	private static final Logger LOGGER = LoggerFactory.getLogger(StunServer.class);
 	Vector<DatagramSocket> sockets;
 	
 	public StunServer(int primaryPort, InetAddress primary, int secondaryPort, InetAddress secondary) throws SocketException {
@@ -99,12 +97,12 @@
 				try {
 					DatagramPacket receive = new DatagramPacket(new byte[200], 200);
 					receiverSocket.receive(receive);
-					LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
+					Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
 					MessageHeader receiveMH = MessageHeader.parseHeader(receive.getData()); 
 					try {
 						receiveMH.parseAttributes(receive.getData());
 						if (receiveMH.getType() == MessageHeaderType.BindingRequest) {
-							LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
+							Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
 							ChangeRequest cr = (ChangeRequest) receiveMH.getMessageAttribute(MessageAttributeType.ChangeRequest);
 							if (cr == null) throw new MessageAttributeException("Message attribute change request is not set.");
 							ResponseAddress ra = (ResponseAddress) receiveMH.getMessageAttribute(MessageAttributeType.ResponseAddress);
@@ -123,7 +121,7 @@
 							ca.setPort(changedPortIP.getLocalPort());
 							sendMH.addMessageAttribute(ca);
 							if (cr.isChangePort() && (!cr.isChangeIP())) {
-								LOGGER.debug("Change port received in Change Request attribute");
+								Log.d("Jstun-StunServer", "Change port received in Change Request attribute");
 								// Source address attribute
 								SourceAddress sa = new SourceAddress();
 								sa.setAddress(new Address(changedPort.getLocalAddress().getAddress()));
@@ -139,9 +137,9 @@
 									send.setAddress(receive.getAddress());
 								}
 								changedPort.send(send);
-								LOGGER.debug(changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
+								Log.d("Jstun-StunServer", changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
 							} else if ((!cr.isChangePort()) && cr.isChangeIP()) {
-								LOGGER.debug("Change ip received in Change Request attribute");
+								Log.d("Jstun-StunServer", "Change ip received in Change Request attribute");
 								// Source address attribute
 								SourceAddress sa = new SourceAddress();
 								sa.setAddress(new Address(changedIP.getLocalAddress().getAddress()));
@@ -157,9 +155,9 @@
 									send.setAddress(receive.getAddress());
 								}
 								changedIP.send(send);
-								LOGGER.debug(changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
+								Log.d("Jstun-StunServer", changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
 							} else if ((!cr.isChangePort()) && (!cr.isChangeIP())) {
-								LOGGER.debug("Nothing received in Change Request attribute");
+								Log.d("Jstun-StunServer", "Nothing received in Change Request attribute");
 								// Source address attribute
 								SourceAddress sa = new SourceAddress();
 								sa.setAddress(new Address(receiverSocket.getLocalAddress().getAddress()));
@@ -175,9 +173,9 @@
 									send.setAddress(receive.getAddress());
 								}
 								receiverSocket.send(send);
-								LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
+								Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
 							} else if (cr.isChangePort() && cr.isChangeIP()) {
-								LOGGER.debug("Change port and ip received in Change Request attribute");
+								Log.d("Jstun-StunServer", "Change port and ip received in Change Request attribute");
 								// Source address attribute
 								SourceAddress sa = new SourceAddress();
 								sa.setAddress(new Address(changedPortIP.getLocalAddress().getAddress()));
@@ -193,7 +191,7 @@
 									send.setAddress(receive.getAddress());
 								}
 								changedPortIP.send(send);
-								LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
+								Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
 							}
 						}
 					} catch (UnknownMessageAttributeException umae) {
@@ -212,7 +210,7 @@
 						send.setPort(receive.getPort());
 						send.setAddress(receive.getAddress());
 						receiverSocket.send(send);
-						LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
+						Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
 					}	
 				} catch (IOException ioe) {
 					ioe.printStackTrace();
diff -Nru src-stun/de/javawi/jstun/test/DiscoveryTest.java src/de/javawi/jstun/test/DiscoveryTest.java
--- src-stun/de/javawi/jstun/test/DiscoveryTest.java	2009-03-08 13:45:49.000000000 +0100
+++ src/de/javawi/jstun/test/DiscoveryTest.java	2009-10-03 14:56:26.816979238 +0200
@@ -20,8 +20,7 @@
 import java.net.SocketTimeoutException;
 import java.net.UnknownHostException;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import android.util.Log;
 
 import de.javawi.jstun.attribute.ChangeRequest;
 import de.javawi.jstun.attribute.ChangedAddress;
@@ -35,7 +34,6 @@
 import de.javawi.jstun.util.UtilityException;
 
 public class DiscoveryTest {
-	private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryTest.class);
 	InetAddress iaddress;
 	String stunServer;
 	int port;
@@ -93,7 +91,7 @@
 				byte[] data = sendMH.getBytes();
 				DatagramPacket send = new DatagramPacket(data, data.length);
 				socketTest1.send(send);
-				LOGGER.debug("Test 1: Binding Request sent.");
+				Log.d("Jstun-DiscoveryTest", "Test 1: Binding Request sent.");
 			
 				MessageHeader receiveMH = new MessageHeader();
 				while (!(receiveMH.equalTransactionID(sendMH))) {
@@ -108,35 +106,35 @@
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 				if (ec != null) {
 					di.setError(ec.getResponseCode(), ec.getReason());
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
 					return false;
 				}
 				if ((ma == null) || (ca == null)) {
 					di.setError(700, "The server is sending an incomplete response (Mapped Address and Changed Address message attributes are missing). The client should not retry.");
-					LOGGER.debug("Response does not contain a Mapped Address or Changed Address message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address or Changed Address message attribute.");
 					return false;
 				} else {
 					di.setPublicIP(ma.getAddress().getInetAddress());
 					if ((ma.getPort() == socketTest1.getLocalPort()) && (ma.getAddress().getInetAddress().equals(socketTest1.getLocalAddress()))) {
-						LOGGER.debug("Node is not natted.");
+						Log.d("Jstun-DiscoveryTest", "Node is not natted.");
 						nodeNatted = false;
 					} else {
-						LOGGER.debug("Node is natted.");
+						Log.d("Jstun-DiscoveryTest", "Node is natted.");
 					}
 					return true;
 				}
 			} catch (SocketTimeoutException ste) {
 				if (timeSinceFirstTransmission < 7900) {
-					LOGGER.debug("Test 1: Socket timeout while receiving the response.");
+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response.");
 					timeSinceFirstTransmission += timeout;
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
 					timeout = timeoutAddValue;
 				} else {
 					// node is not capable of udp communication
-					LOGGER.debug("Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
 					di.setBlockedUDP();
-					LOGGER.debug("Node is not capable of UDP communication.");
+					Log.d("Jstun-DiscoveryTest", "Node is not capable of UDP communication.");
 					return false;
 				}
 			} 
@@ -164,7 +162,7 @@
 				byte[] data = sendMH.getBytes(); 
 				DatagramPacket send = new DatagramPacket(data, data.length);
 				sendSocket.send(send);
-				LOGGER.debug("Test 2: Binding Request sent.");
+				Log.d("Jstun-DiscoveryTest", "Test 2: Binding Request sent.");
 				
 				int localPort = sendSocket.getLocalPort();
 				InetAddress localAddress = sendSocket.getLocalAddress();
@@ -185,29 +183,29 @@
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 				if (ec != null) {
 					di.setError(ec.getResponseCode(), ec.getReason());
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
 					return false;
 				}
 				if (!nodeNatted) {
 					di.setOpenAccess();
-					LOGGER.debug("Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
+					Log.d("Jstun-DiscoveryTest", "Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
 				} else {
 					di.setFullCone();
-					LOGGER.debug("Node is behind a full-cone NAT.");
+					Log.d("Jstun-DiscoveryTest", "Node is behind a full-cone NAT.");
 				}
 				return false;
 			} catch (SocketTimeoutException ste) {
 				if (timeSinceFirstTransmission < 7900) {
-					LOGGER.debug("Test 2: Socket timeout while receiving the response.");
+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response.");
 					timeSinceFirstTransmission += timeout;
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
 					timeout = timeoutAddValue;
 				} else {
-					LOGGER.debug("Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
 					if (!nodeNatted) {
 						di.setSymmetricUDPFirewall();
-						LOGGER.debug("Node is behind a symmetric UDP firewall.");
+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric UDP firewall.");
 						return false;
 					} else {
 						// not is natted
@@ -238,7 +236,7 @@
 				byte[] data = sendMH.getBytes();
 				DatagramPacket send = new DatagramPacket(data, data.length);
 				socketTest1.send(send);
-				LOGGER.debug("Test 1 redo with changed address: Binding Request sent.");
+				Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Binding Request sent.");
 				
 				MessageHeader receiveMH = new MessageHeader();
 				while (!(receiveMH.equalTransactionID(sendMH))) {
@@ -251,30 +249,30 @@
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 				if (ec != null) {
 					di.setError(ec.getResponseCode(), ec.getReason());
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
 					return false;
 				}
 				if (ma2 == null) {
 					di.setError(700, "The server is sending an incomplete response (Mapped Address message attribute is missing). The client should not retry.");
-					LOGGER.debug("Response does not contain a Mapped Address message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address message attribute.");
 					return false;
 				} else {
 					if ((ma.getPort() != ma2.getPort()) || (!(ma.getAddress().getInetAddress().equals(ma2.getAddress().getInetAddress())))) {
 						di.setSymmetric();
-						LOGGER.debug("Node is behind a symmetric NAT.");
+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric NAT.");
 						return false;
 					}
 				}
 				return true;
 			} catch (SocketTimeoutException ste2) {
 				if (timeSinceFirstTransmission < 7900) {
-					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.");
+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.");
 					timeSinceFirstTransmission += timeout;
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
 					timeout = timeoutAddValue;
 				} else {
-					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
 					return false;
 				}
 			}
@@ -301,7 +299,7 @@
 				byte[] data = sendMH.getBytes();
 				DatagramPacket send = new DatagramPacket(data, data.length);
 				sendSocket.send(send);
-				LOGGER.debug("Test 3: Binding Request sent.");
+				Log.d("Jstun-DiscoveryTest", "Test 3: Binding Request sent.");
 				
 				int localPort = sendSocket.getLocalPort();
 				InetAddress localAddress = sendSocket.getLocalAddress();
@@ -322,25 +320,25 @@
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
 				if (ec != null) {
 					di.setError(ec.getResponseCode(), ec.getReason());
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
 					return;
 				}
 				if (nodeNatted) {
 					di.setRestrictedCone();
-					LOGGER.debug("Node is behind a restricted NAT.");
+					Log.d("Jstun-DiscoveryTest", "Node is behind a restricted NAT.");
 					return;
 				}
 			} catch (SocketTimeoutException ste) {
 				if (timeSinceFirstTransmission < 7900) {
-					LOGGER.debug("Test 3: Socket timeout while receiving the response.");
+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response.");
 					timeSinceFirstTransmission += timeout;
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
 					timeout = timeoutAddValue;
 				} else {
-					LOGGER.debug("Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
 					di.setPortRestrictedCone();
-					LOGGER.debug("Node is behind a port restricted NAT.");
+					Log.d("Jstun-DiscoveryTest", "Node is behind a port restricted NAT.");
 					return;
 				}
 			}