gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21938 - in gnunet-java: . src/org/gnunet src/org/gnunet/co


From: gnunet
Subject: [GNUnet-SVN] r21938 - in gnunet-java: . src/org/gnunet src/org/gnunet/construct src/org/gnunet/construct/parsers src/org/gnunet/mesh src/org/gnunet/peerinfo src/org/gnunet/statistics src/org/gnunet/testing src/org/gnunet/transport src/org/gnunet/util test/org/gnunet test/org/gnunet/core test/org/gnunet/dht test/org/gnunet/statistics test/org/gnunet/testing test/org/gnunet/util test/org/gnunet/util/getopt test/org/org/gnunet/nse tools
Date: Wed, 13 Jun 2012 02:03:57 +0200

Author: dold
Date: 2012-06-13 02:03:56 +0200 (Wed, 13 Jun 2012)
New Revision: 21938

Added:
   gnunet-java/src/org/gnunet/mesh/
   gnunet-java/src/org/gnunet/mesh/Mesh.java
   gnunet-java/src/org/gnunet/peerinfo/
   gnunet-java/src/org/gnunet/peerinfo/HelloMessage.java
   gnunet-java/src/org/gnunet/peerinfo/InfoMessage.java
   gnunet-java/src/org/gnunet/peerinfo/ListPeerMessage.java
   gnunet-java/src/org/gnunet/peerinfo/PeerInfo.java
   gnunet-java/src/org/gnunet/peerinfo/RsaPublicKeyBinaryEncoded.java
   gnunet-java/src/org/gnunet/testing/
   gnunet-java/src/org/gnunet/testing/TestingSetup.java
   gnunet-java/src/org/gnunet/testing/TestingSubsystem.java
   gnunet-java/src/org/gnunet/transport/
   gnunet-java/src/org/gnunet/transport/Transport.java
   gnunet-java/src/org/gnunet/util/Service.java
   gnunet-java/test/org/gnunet/testing/
   gnunet-java/test/org/gnunet/testing/TestingSetupTest.java
Removed:
   gnunet-java/src/org/gnunet/util/Service.java
   gnunet-java/test/org/gnunet/statistics/statistics-test.conf
   gnunet-java/test/org/gnunet/util/TestingSetup.java
Modified:
   gnunet-java/ISSUES
   gnunet-java/src/org/gnunet/construct/Construct.java
   gnunet-java/src/org/gnunet/construct/MsgMap.txt
   gnunet-java/src/org/gnunet/construct/parsers/ByteFillParser.java
   gnunet-java/src/org/gnunet/construct/parsers/DoubleParser.java
   gnunet-java/src/org/gnunet/construct/parsers/FillParser.java
   gnunet-java/src/org/gnunet/construct/parsers/FixedSizeArrayParser.java
   gnunet-java/src/org/gnunet/construct/parsers/FixedSizeByteArrayParser.java
   gnunet-java/src/org/gnunet/construct/parsers/IntegerFillParser.java
   gnunet-java/src/org/gnunet/construct/parsers/IntegerParser.java
   gnunet-java/src/org/gnunet/construct/parsers/NestedParser.java
   gnunet-java/src/org/gnunet/construct/parsers/Parser.java
   gnunet-java/src/org/gnunet/construct/parsers/SequenceParser.java
   gnunet-java/src/org/gnunet/construct/parsers/StringParser.java
   gnunet-java/src/org/gnunet/construct/parsers/UnionParser.java
   gnunet-java/src/org/gnunet/construct/parsers/VariableSizeArrayParser.java
   gnunet-java/src/org/gnunet/statistics/Statistics.java
   gnunet-java/src/org/gnunet/util/Connection.java
   gnunet-java/src/org/gnunet/util/RelativeTime.java
   gnunet-java/src/org/gnunet/util/Resolver.java
   gnunet-java/src/org/gnunet/util/Scheduler.java
   gnunet-java/src/org/gnunet/util/Server.java
   gnunet-java/test/org/gnunet/core/CoreTest.java
   gnunet-java/test/org/gnunet/dht/DHTTest.java
   gnunet-java/test/org/gnunet/statistics/StatisticsTest.java
   gnunet-java/test/org/gnunet/util/ResolverTest.java
   gnunet-java/test/org/gnunet/util/getopt/GetoptTest.java
   gnunet-java/test/org/org/gnunet/nse/NSETest.java
   gnunet-java/tools/build
Log:
fixes; made test cases independent of a running gnunet system, started 
refactoring construct

Modified: gnunet-java/ISSUES
===================================================================
--- gnunet-java/ISSUES  2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/ISSUES  2012-06-13 00:03:56 UTC (rev 21938)
@@ -130,4 +130,43 @@
 
 * long-term todos:
  * refactor the Construct implementation, implement the "nicer" syntax
- * refactor the getopt implementation
\ No newline at end of file
+ * refactor the getopt implementation
+
+
+
+
+============================================================
+
+gnunet needs to compiled with --disable-nls to work on the cobertura accout
+
+
+* we are still not able to test "temporary destruction"
+ * because every time a new port may be generated
+ * we need a way to kill a service and run it with the same config
+ * now implemented!
+* review if everything in Makefile.am is correct
+ * what is *_DEPENDENCIES vs *_LDADD?
+* how do we get a handle to stdin (in a non-hacky way) that can be selected on 
by scheduler?
+* c-getopt question: GNUNET_GETOPT_run returns index of first non-option.
+  so options and non-options may not be mixed?
+* i have to manually write the config file, why isn't there a way to get the
+  file name, not just the ConfigurationHandle?
+* could we get a confirmation that a service *really* is dead?
+ * or is this guaranteed if TESTING_service_run returns?
+ * otherwise there is no way to reliably test behavior on interrupted 
connection
+* TESTING_service_run does not indicate that the service could not be run!
+ * just logs an error
+ * currently we check availability of data on stderr.
+
+
+
+PEERINFO_GET vs PEERINFO_GET_ALL
+ * if we have PEERINFO_GET_ALL, why is the peer-field in ListPeerMessage(with 
type=PEERINFO_GET) empty?
+
+
+* are peerinfo requests queued?
+ * i remember discussing peerinfo as a compilicated example for a general 
message queueing implementation. why?
+* can peerinfo return more than one record per peer?
+
+
+

Modified: gnunet-java/src/org/gnunet/construct/Construct.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/Construct.java 2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/construct/Construct.java 2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -66,33 +66,6 @@
             Parser>(100);
 
     /**
-     * Information the root of the parser, if the target is nested in another 
message.
-     */
-    private static class ParserContext {
-        List<Field> parserPath = new ArrayList<Field>();
-        // fully determined by parserPath
-        ArrayList<Field> frameSizePath = new ArrayList<Field>();
-
-        @Override
-        public boolean equals(Object other) {
-            // parsers with an equal parserPath also always have the same 
frameSizePath
-            return this.parserPath.equals(((ParserContext) other).parserPath);
-        }
-
-        @Override
-        public int hashCode() {
-            return parserPath.hashCode();
-        }
-    }
-
-    private static class RootedParser {
-        // null if target itself is root
-        ParserContext root;
-        Parser parser;
-    }
-
-
-    /**
      * Given a byte buffer with a message, parse it into an object of type c. 
The
      * fields of the class are expected to be annotated with annotations from
      * the construct package.
@@ -104,7 +77,7 @@
     public static <T extends Message> T parseAs(ByteBuffer srcBuf, Class<T> c) 
{
         T m = ReflectUtil.justInstantiate(c);
 
-        getParser(c).parse(srcBuf, 0, m, m);
+        getParser(c).parse(srcBuf, 0, m, m, null);
 
         return m;
     }

Modified: gnunet-java/src/org/gnunet/construct/MsgMap.txt
===================================================================
--- gnunet-java/src/org/gnunet/construct/MsgMap.txt     2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/construct/MsgMap.txt     2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -29,4 +29,4 @@
 org.gnunet.util.GnunetMessage$Body|168=org.gnunet.statistics.SetMessage
 
org.gnunet.util.GnunetMessage$Body|173=org.gnunet.statistics.WatchResponseMessage
 org.gnunet.util.GnunetMessage$Body|172=org.gnunet.statistics.WatchMessage
-# generated 2012/05/29 19:00:30
+# generated 2012/05/30 13:59:09

Modified: gnunet-java/src/org/gnunet/construct/parsers/ByteFillParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/ByteFillParser.java    
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/ByteFillParser.java    
2012-06-13 00:03:56 UTC (rev 21938)
@@ -67,7 +67,7 @@
 
 
     @Override
-    public int parse(ByteBuffer srcBuf, int frameOffset, Message frameObj, 
Message dst) {
+    public int parse(ByteBuffer srcBuf, int frameOffset, Message frameObj, 
Message dst, List<Field> frameSizePath) {
         int frameSize = (int) 
totalSizeField.get(ReflectUtil.followFieldPathToParent(totalSizePath, 
frameObj));
         int remaining = frameOffset + frameSize - srcBuf.position();
 

Modified: gnunet-java/src/org/gnunet/construct/parsers/DoubleParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/DoubleParser.java      
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/DoubleParser.java      
2012-06-13 00:03:56 UTC (rev 21938)
@@ -25,6 +25,7 @@
 
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 public class DoubleParser implements Parser {
     
@@ -40,7 +41,7 @@
     }
 
     @Override
-    public int parse(ByteBuffer srcBuf, int frameOffset, Message frameObj, 
Message dstObj) {
+    public int parse(ByteBuffer srcBuf, int frameOffset, Message frameObj, 
Message dstObj, List<Field> frameSizePath) {
         double d = srcBuf.getDouble();
         try {
             targetField.setDouble(dstObj, d);

Modified: gnunet-java/src/org/gnunet/construct/parsers/FillParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/FillParser.java        
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/FillParser.java        
2012-06-13 00:03:56 UTC (rev 21938)
@@ -65,7 +65,7 @@
 
     @Override
     public int parse(ByteBuffer srcBuf, int frameOffset,
-                     Message frameObj, final Message dstObj) {
+                     Message frameObj, final Message dstObj, List<Field> 
frameSizePath) {
 
         final int frameSize = (int) 
totalSizeField.get(ReflectUtil.followFieldPathToParent(totalSizePath, 
frameObj));
         int remaining = frameOffset + frameSize - srcBuf.position();
@@ -76,7 +76,7 @@
         while (remaining > 0) {
             @SuppressWarnings("unchecked")
             Message next = ReflectUtil.justInstantiate((Class<Message>) 
targetField.getType().getComponentType());
-            int s = elemParser.parse(srcBuf, frameOffset, frameObj, next);
+            int s = elemParser.parse(srcBuf, frameOffset, frameObj, next, 
null);
             size += s;
             remaining -= s;
         }

Modified: gnunet-java/src/org/gnunet/construct/parsers/FixedSizeArrayParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/FixedSizeArrayParser.java      
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/FixedSizeArrayParser.java      
2012-06-13 00:03:56 UTC (rev 21938)
@@ -26,6 +26,7 @@
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 public class FixedSizeArrayParser implements Parser {
 
@@ -59,7 +60,7 @@
 
     @Override
     public int parse(ByteBuffer srcBuf, int frameOffset,
-                     Message frameObj, final Message dstObj) {
+                     Message frameObj, final Message dstObj, List<Field> 
frameSizePath) {
         int size = 0;
 
         final Object arr = 
Array.newInstance(targetField.getType().getComponentType(), elemNumber);
@@ -70,7 +71,7 @@
             Message elemObj = 
ReflectUtil.justInstantiate((Class<Message>)targetField.getType().getComponentType());
             Array.set(arr, i, elemObj);
 
-            size += elemParser.parse(srcBuf, frameOffset - size, frameObj, 
elemObj);
+            size += elemParser.parse(srcBuf, frameOffset - size, frameObj, 
elemObj, null);
         }
 
         return size;

Modified: 
gnunet-java/src/org/gnunet/construct/parsers/FixedSizeByteArrayParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/FixedSizeByteArrayParser.java  
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/FixedSizeByteArrayParser.java  
2012-06-13 00:03:56 UTC (rev 21938)
@@ -25,6 +25,7 @@
 
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 public class FixedSizeByteArrayParser implements Parser {
     private final int elemNumber;
@@ -41,7 +42,7 @@
     }
 
     @Override
-    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj) {
+    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj, List<Field> frameSizePath) {
         byte[] data = new byte[elemNumber];
         srcBuf.get(data);
         ReflectUtil.justSet(dstObj, targetField, data);

Modified: gnunet-java/src/org/gnunet/construct/parsers/IntegerFillParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/IntegerFillParser.java 
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/IntegerFillParser.java 
2012-06-13 00:03:56 UTC (rev 21938)
@@ -59,7 +59,7 @@
     }
 
     @Override
-    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj) {
+    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj, List<Field> frameSizePath) {
         final int frameSize = (int) 
totalSizeField.get(ReflectUtil.followFieldPathToParent(totalSizePath, 
frameObj));
         int remaining = frameStart + frameSize - srcBuf.position();
 

Modified: gnunet-java/src/org/gnunet/construct/parsers/IntegerParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/IntegerParser.java     
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/IntegerParser.java     
2012-06-13 00:03:56 UTC (rev 21938)
@@ -25,6 +25,7 @@
 
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 /**
  *
@@ -56,7 +57,8 @@
     }
 
     @Override
-    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj) {
+    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj, List<Field>
+            frameSizePath) {
         if (targetField.isBig()) {
             targetField.set(dstObj, IntegerUtil.readBigInteger(srcBuf, 
isSigned, byteSize));
         } else {

Modified: gnunet-java/src/org/gnunet/construct/parsers/NestedParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/NestedParser.java      
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/NestedParser.java      
2012-06-13 00:03:56 UTC (rev 21938)
@@ -58,7 +58,8 @@
     }
 
     @Override
-    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj) {
+    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj, List<Field>
+            frameSizePath) {
         if (newFrame) {
             frameObj = dstObj;
             frameOffset = 0;
@@ -82,7 +83,7 @@
         ReflectUtil.justSet(dstObj, targetField, 
ReflectUtil.justInstantiate(targetField.getType()));
 
         return nestedParser.parse(srcBuf, frameOffset,
-                frameObj, (Message) ReflectUtil.justGet(dstObj, targetField));
+                frameObj, (Message) ReflectUtil.justGet(dstObj, targetField), 
null);
     }
 
     @Override

Modified: gnunet-java/src/org/gnunet/construct/parsers/Parser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/Parser.java    2012-06-12 
23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/Parser.java    2012-06-13 
00:03:56 UTC (rev 21938)
@@ -22,7 +22,9 @@
 
 import org.gnunet.construct.Message;
 
+import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 
 public interface Parser {
@@ -34,16 +36,18 @@
      */
     public int getSize(Message srcObj);
 
+
     /**
-     * 
+     * Parse from a ByteBuffer into a destination object.
      *
      * @param srcBuf the buffer containing the binary data to construct this 
object
      * @param frameStart start of the current frame, relative to the beginning 
of srcBuf
      * @param frameObj the object containing the dstObj, dstObj if dstObj 
itself is the frame object
      * @param dstObj the object whose members are written according according 
to the data in srcBuf
+     * @param frameSizePath
      * @return number of byres read from srcBuf
      */
-    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj);
+    public int parse(ByteBuffer srcBuf, int frameStart, Message frameObj, 
Message dstObj, List<Field> frameSizePath);
 
     /**
      * 

Modified: gnunet-java/src/org/gnunet/construct/parsers/SequenceParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/SequenceParser.java    
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/SequenceParser.java    
2012-06-13 00:03:56 UTC (rev 21938)
@@ -22,6 +22,7 @@
 
 import org.gnunet.construct.Message;
 
+import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
 import java.util.LinkedList;
 import java.util.List;
@@ -53,10 +54,10 @@
 
     @Override
     public int parse(final ByteBuffer srcBuf, int frameOffset,
-                     Message frameObj, final Message dst) {
+                     Message frameObj, final Message dst, List<Field> 
frameSizePath) {
         int size = 0;
         for (final Parser p : childParsers) {
-            size += p.parse(srcBuf, frameOffset, frameObj, dst);
+            size += p.parse(srcBuf, frameOffset, frameObj, dst, null);
         }
         return size;
     }

Modified: gnunet-java/src/org/gnunet/construct/parsers/StringParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/StringParser.java      
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/StringParser.java      
2012-06-13 00:03:56 UTC (rev 21938)
@@ -27,6 +27,7 @@
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 public class StringParser implements Parser {
 
@@ -59,7 +60,8 @@
     }
 
     @Override
-    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj) {
+    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj, List<Field>
+            frameSizePath) {
 
         if (srcBuf.get(srcBuf.position()) == 0) {
             if (!optional) {

Modified: gnunet-java/src/org/gnunet/construct/parsers/UnionParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/UnionParser.java       
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/UnionParser.java       
2012-06-13 00:03:56 UTC (rev 21938)
@@ -70,7 +70,8 @@
     }
 
     @Override
-    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj) {
+    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj, List<Field>
+            frameSizePath) {
         if (optional) {
             int remaining = frameOffset + getSizeFieldValue(frameObj) - 
srcBuf.position();
             if (remaining <= 0) {
@@ -92,9 +93,9 @@
 
         final Message theUnion = (Message) ReflectUtil.justGet(dstObj, 
targetField);
 
-        Parser parser = Construct.getParser(cls, frameSizePath, pathFromRoot);
+        Parser parser = Construct.getParser(cls, this.frameSizePath, 
pathFromRoot);
 
-        return parser.parse(srcBuf, frameOffset, frameObj, theUnion);
+        return parser.parse(srcBuf, frameOffset, frameObj, theUnion, null);
     }
 
     @Override

Modified: 
gnunet-java/src/org/gnunet/construct/parsers/VariableSizeArrayParser.java
===================================================================
--- gnunet-java/src/org/gnunet/construct/parsers/VariableSizeArrayParser.java   
2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/construct/parsers/VariableSizeArrayParser.java   
2012-06-13 00:03:56 UTC (rev 21938)
@@ -26,6 +26,7 @@
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 public class VariableSizeArrayParser implements Parser {
     private final Field targetField;
@@ -55,7 +56,8 @@
     }
 
     @Override
-    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj) {
+    public int parse(final ByteBuffer srcBuf, int frameOffset, Message 
frameObj, final Message dstObj, List<Field>
+            frameSizePath) {
         final int elemNumber = (int) sizeField.get(dstObj);
         @SuppressWarnings("unchecked")
         final Class<Message> arrayElementType = (Class<Message>) 
targetField.getType().getComponentType();
@@ -73,7 +75,7 @@
 
             Array.set(arr, i, elemObj);
 
-            size += elemParser.parse(srcBuf, frameOffset - size, null, 
elemObj);
+            size += elemParser.parse(srcBuf, frameOffset - size, null, 
elemObj, null);
         }
 
         return size;

Added: gnunet-java/src/org/gnunet/mesh/Mesh.java
===================================================================
--- gnunet-java/src/org/gnunet/mesh/Mesh.java                           (rev 0)
+++ gnunet-java/src/org/gnunet/mesh/Mesh.java   2012-06-13 00:03:56 UTC (rev 
21938)
@@ -0,0 +1,50 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.mesh;
+
+import org.gnunet.util.Cancelable;
+import org.gnunet.util.Configuration;
+
+/**
+ * @author Florian Dold
+ */
+public class Mesh {
+    public class Tunnel {
+        public void destroy() {
+            // ...
+        }
+        public Cancelable notifyTransmitReady(/* ... */) {
+            return null;
+        }
+    }
+
+    public Mesh(Configuration cfg, int queueSize) {
+
+    }
+
+    public Tunnel createTunnel(/* ... */) {
+        return null;
+    }
+
+    public void disconnect() {
+
+    }
+}

Added: gnunet-java/src/org/gnunet/peerinfo/HelloMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/peerinfo/HelloMessage.java                       
        (rev 0)
+++ gnunet-java/src/org/gnunet/peerinfo/HelloMessage.java       2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,51 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.peerinfo;
+
+import org.gnunet.construct.*;
+
+/**
+ * A HELLO message is used to exchange information about
+ * transports with other peers.  This struct is always
+ * followed by the actual network addresses which have
+ * the format:
+ *
+ * 1) transport-name (0-terminated)
+ * 2) address-length (uint16_t, network byte order; possibly
+ *    unaligned!)
+ * 3) address expiration (GNUNET_TIME_AbsoluteNBO); possibly
+ *    unaligned!)
+ * 4) address (address-length bytes; possibly unaligned!)
+
+ *
+ * @author Florian Dold
+ */
address@hidden(16)
+public class HelloMessage implements Message {
+    @UInt32
+    public int reserved;
+
+    @NestedMessage
+    public RsaPublicKeyBinaryEncoded publicKey;
+
+    @ByteFill
+    public byte[] addresses;
+}

Added: gnunet-java/src/org/gnunet/peerinfo/InfoMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/peerinfo/InfoMessage.java                        
        (rev 0)
+++ gnunet-java/src/org/gnunet/peerinfo/InfoMessage.java        2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,40 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.peerinfo;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt32;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * @author Florian Dold
+ */
+public class InfoMessage {
+    @UInt32
+    public int reserved;
+    @NestedMessage
+    public PeerIdentity peerIdentity;
+    /**
+     * Hello of the peer, only there if available.
+     */
+    @NestedMessage(optional = true)
+    public HelloMessage hello;
+}

Added: gnunet-java/src/org/gnunet/peerinfo/ListPeerMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/peerinfo/ListPeerMessage.java                    
        (rev 0)
+++ gnunet-java/src/org/gnunet/peerinfo/ListPeerMessage.java    2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,33 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.peerinfo;
+
+import org.gnunet.util.GnunetMessage;
+
+/**
+ * Message requesting a listing of all known peers,
+ * possibly restricted to the specified peer identity.
+ *
+ * @author Florian Dold
+ */
+public class ListPeerMessage implements GnunetMessage.Body {
+
+}

Added: gnunet-java/src/org/gnunet/peerinfo/PeerInfo.java
===================================================================
--- gnunet-java/src/org/gnunet/peerinfo/PeerInfo.java                           
(rev 0)
+++ gnunet-java/src/org/gnunet/peerinfo/PeerInfo.java   2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -0,0 +1,54 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.peerinfo;
+
+import org.gnunet.util.Cancelable;
+import org.gnunet.util.Configuration;
+import org.gnunet.util.PeerIdentity;
+import org.gnunet.util.RelativeTime;
+
+/**
+ * Interface to the service that maintains all known hosts.
+ *
+ * @author Florian Dold
+ */
+public class PeerInfo {
+    public interface PeerIterator {
+        public void onPeer(PeerIdentity peerIdentity, HelloMessage hello);
+        public void onEnd();
+    }
+
+    public PeerInfo(Configuration cfg) {
+
+    }
+
+    public Cancelable iterate(RelativeTime timeout, PeerIterator iterator) {
+        return null;
+    }
+
+    public Cancelable iterate(RelativeTime timeout, PeerIdentity peer, 
PeerIterator iterator) {
+        return null;
+    }
+
+    public void disconnect() {
+
+    }
+}

Added: gnunet-java/src/org/gnunet/peerinfo/RsaPublicKeyBinaryEncoded.java
===================================================================
--- gnunet-java/src/org/gnunet/peerinfo/RsaPublicKeyBinaryEncoded.java          
                (rev 0)
+++ gnunet-java/src/org/gnunet/peerinfo/RsaPublicKeyBinaryEncoded.java  
2012-06-13 00:03:56 UTC (rev 21938)
@@ -0,0 +1,55 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.peerinfo;
+
+import org.gnunet.construct.FixedSizeByteArray;
+import org.gnunet.construct.UInt16;
+import org.gnunet.construct.UInt8;
+
+/**
+ * @author Florian Dold
+ */
+public class RsaPublicKeyBinaryEncoded {
+    public static final int GNUNET_CRYPTO_RSA_KEY_LENGTH = 258;
+
+    /**
+     * In big-endian, must be GNUNET_CRYPTO_RSA_KEY_LENGTH+4
+     */
+    @UInt16
+    public int len;
+    /**
+     * Size of n in key; in big-endian!
+     */
+    @UInt16
+    public int sizen;
+
+    /**
+     * The key itself, contains n followed by e.
+     */
+    @FixedSizeByteArray(length = 
RsaPublicKeyBinaryEncoded.GNUNET_CRYPTO_RSA_KEY_LENGTH)
+    public byte[] key;
+
+    /**
+     * Padding.
+     */
+    @UInt8
+    public byte reserved;
+}

Modified: gnunet-java/src/org/gnunet/statistics/Statistics.java
===================================================================
--- gnunet-java/src/org/gnunet/statistics/Statistics.java       2012-06-12 
23:01:39 UTC (rev 21937)
+++ gnunet-java/src/org/gnunet/statistics/Statistics.java       2012-06-13 
00:03:56 UTC (rev 21938)
@@ -203,6 +203,7 @@
         }
 
         public void visit(GetResponseEndMessage m) {
+            currentGetReceiver = null;
             if (currentGetContinuation != null) {
                 currentGetContinuation.cont(true);
             }

Copied: gnunet-java/src/org/gnunet/testing/TestingSetup.java (from rev 21897, 
gnunet-java/test/org/gnunet/util/TestingSetup.java)
===================================================================
--- gnunet-java/src/org/gnunet/testing/TestingSetup.java                        
        (rev 0)
+++ gnunet-java/src/org/gnunet/testing/TestingSetup.java        2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,60 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.testing;
+
+import org.gnunet.util.Program;
+
+/**
+ * @author Florian Dold
+ */
+public class TestingSetup {
+
+    public static class SetupException extends RuntimeException {
+        public SetupException(String msg, Throwable cause) {
+            super(msg, cause);
+        }
+
+        public SetupException(String msg) {
+            super(msg);
+        }
+
+        public SetupException(Throwable cause) {
+            super(cause);
+        }
+    }
+
+    /**
+     * Start a subsystem for testing. Note that subsystems started with this 
function
+     * are independent of each other.
+     *
+     * After the JVM exits, the subsystem will be shut down.
+     *
+     * @param name name of the Subsystem
+     * @return
+     */
+    public TestingSubsystem startSubsystem(String name) {
+        return new TestingSubsystem(name);
+    }
+
+    public TestingSetup() {
+        Program.configureLogging("DEBUG", null);
+    }
+}

Added: gnunet-java/src/org/gnunet/testing/TestingSubsystem.java
===================================================================
--- gnunet-java/src/org/gnunet/testing/TestingSubsystem.java                    
        (rev 0)
+++ gnunet-java/src/org/gnunet/testing/TestingSubsystem.java    2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,114 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.testing;
+
+import org.gnunet.util.Configuration;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+/**
+* @author Florian Dold
+*/
+public class TestingSubsystem {
+    private Process p;
+    private BufferedReader reader;
+    private OutputStreamWriter writer;
+    private Configuration cfg;
+
+    public Configuration getConfiguration() {
+        return cfg;
+    }
+
+    TestingSubsystem(String service) {
+        try {
+            p = Runtime.getRuntime().exec(new 
String[]{"gnunet-testing-run-service", service});
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+
+        writer = new OutputStreamWriter(p.getOutputStream());
+
+        String cfgFileName;
+        try {
+            cfgFileName = reader.readLine();
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        cfg = new Configuration();
+        cfg.parse(cfgFileName);
+
+        try {
+            if (p.getErrorStream().available() != 0) {
+                throw new TestingSetup.SetupException("error starting 
service");
+            }
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+    }
+    public void destroy() {
+        try {
+            p.getOutputStream().close();
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        String line;
+        try {
+            line = reader.readLine();
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        p.destroy();
+        if (!line.equals("bye")) {
+            throw new TestingSetup.SetupException("service not destroyed 
correctly");
+        }
+        try {
+            p.waitFor();
+        } catch (InterruptedException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        if (p.exitValue() != 0) {
+            throw new TestingSetup.SetupException("wrong exit value");
+        }
+    }
+
+    public void restart() {
+        try {
+            writer.write("r\n");
+            writer.flush();
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        String response = null;
+        System.out.println("waiting");
+        try {
+            response = reader.readLine();
+        } catch (IOException e) {
+            throw new TestingSetup.SetupException(e);
+        }
+        if (!response.equals("restarted")) {
+            throw new TestingSetup.SetupException("wrapper did not cooperate");
+        }
+    }
+}

Added: gnunet-java/src/org/gnunet/transport/Transport.java
===================================================================
--- gnunet-java/src/org/gnunet/transport/Transport.java                         
(rev 0)
+++ gnunet-java/src/org/gnunet/transport/Transport.java 2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -0,0 +1,64 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.transport;
+
+import org.gnunet.util.Cancelable;
+import org.gnunet.util.Configuration;
+import org.gnunet.util.PeerIdentity;
+import org.gnunet.util.RelativeTime;
+
+/**
+ * low-level peer-to-peer I/O API
+ *
+ * @author Florian Dold
+ */
+public class Transport {
+    public Transport(Configuration cfg, PeerIdentity self, ReceiveCallback rec,
+                     NotifyConnect nc, NotifyDisconnect nd) {
+
+    }
+
+    /**
+     * Ask the transport service to establish a connection
+     * to the given peer.
+     *
+     * @param target who we should try to connect to
+     */
+    public void tryConnect(PeerIdentity target) {
+
+    }
+
+    public static Cancelable addressToString(Configuration cfg, Object 
address, boolean numeric,
+                                             RelativeTime timeout, Object cb) {
+        return null;
+    }
+
+
+    public void disconnect() {
+
+    }
+
+    private interface ReceiveCallback {}
+
+    private interface NotifyDisconnect {}
+
+    private interface NotifyConnect {}
+}

Modified: gnunet-java/src/org/gnunet/util/Connection.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Connection.java     2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/util/Connection.java     2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -155,6 +155,7 @@
                 found = false;
             }
 
+            logger.debug("dispatching received message");
             if (found) {
                 GnunetMessage msg = Construct.parseAs(recvBuffer, 
GnunetMessage.class);
                 receiver.process(msg.body);
@@ -408,6 +409,8 @@
 
         @Override
         public void onTimeout() {
+            // do nothing
+            // todo: is this correct?
         }
     }
 

Modified: gnunet-java/src/org/gnunet/util/RelativeTime.java
===================================================================
--- gnunet-java/src/org/gnunet/util/RelativeTime.java   2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/util/RelativeTime.java   2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -46,6 +46,11 @@
 
     private final long rel_value;
 
+    /**
+     * Create a new RelativeTime value, with a given time in milliseconds.
+     *
+     * @param abs_value time in milliseconds
+     */
     public RelativeTime(final long abs_value) {
         this.rel_value = abs_value;
     }

Modified: gnunet-java/src/org/gnunet/util/Resolver.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Resolver.java       2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/util/Resolver.java       2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -100,7 +100,7 @@
      * @return the IPv4 InetAddress corresponding to ip, null if ip is not a 
IPv4 address.
      */
     public InetAddress getInet4AddressFromString(String ip) {
-        String[] components = ip.split(".");
+        String[] components = ip.split("[.]");
         if (components.length != 4) {
             return null;
         }
@@ -167,7 +167,7 @@
         if (inAddr != null) {
             return inAddr;
         }
-        return getInet4AddressFromString(ip);
+        return getInet6AddressFromString(ip);
     }
 
     /**
@@ -195,7 +195,7 @@
 
     /**
      * Configuration to use with the Resolver.
-     *
+     * <p/>
      * Usually called by the entry points Program/Service.
      *
      * @param cfg configuration to use
@@ -268,51 +268,37 @@
      * Resolve the hostname 'hostname'.
      *
      * @param hostname hostname to resolve
-     * @param timeout timeout, calls cb.onTimeout on expiratoin
-     * @param cb callback
-     * @return a handle to cancel the request
+     * @param timeout  timeout, calls cb.onTimeout on expiratoin
+     * @param cb       callback
+     * @return a handle to cancel the request, null if request could be 
satisfied immediately
      */
     public Cancelable resolveHostname(String hostname, RelativeTime timeout, 
final AddressCallback cb) {
-        final ResolveHandle rh = new ResolveHandle();
-        rh.hostname = hostname;
-        rh.deadline = timeout.toAbsolute();
-        rh.cb = cb;
         // try if hostname is numeric IP or loopback
         if (hostname.equalsIgnoreCase("localhost")) {
             logger.debug("resolving address locally");
-            Scheduler.add(new Scheduler.Task() {
-                @Override
-                public void run(Scheduler.RunContext ctx) {
-                    cb.onAddress(getInet6Localhost());
-                    cb.onAddress(getInet4Localhost());
-                    rh.finished = true;
-                    cb.onFinished();
-                }
-            });
-
-            return rh;
+            cb.onAddress(getInet6Localhost());
+            cb.onAddress(getInet4Localhost());
+            cb.onFinished();
+            return null;
         }
         if (hostname.equalsIgnoreCase("ip6-localhost")) {
-            Scheduler.add(new Scheduler.Task() {
-                @Override
-                public void run(Scheduler.RunContext ctx) {
-                    cb.onAddress(getInet6Localhost());
-                    rh.finished = true;
-                    cb.onFinished();
-                }
-            });
-
-            return rh;
+            cb.onAddress(getInet6Localhost());
+            cb.onFinished();
+            return null;
         }
 
-        InetAddress inetAddr = getInetAddressFromString(rh.hostname);
+        InetAddress inetAddr = getInetAddressFromString(hostname);
         if (inetAddr != null) {
             cb.onAddress(inetAddr);
-            rh.finished = true;
             cb.onFinished();
-            return rh;
+            return null;
         }
 
+        final ResolveHandle rh = new ResolveHandle();
+        rh.hostname = hostname;
+        rh.deadline = timeout.toAbsolute();
+        rh.cb = cb;
+
         queuedRequests.addLast(rh);
         handleNextRequest();
         return rh;
@@ -353,55 +339,55 @@
         rh.transmitTask = client.notifyTransmitReady(
                 deadline.getRemaining(), true,
                 0, new MessageTransmitter() {
-                    @Override
-                    public void transmit(Connection.MessageSink sink) {
-                        if (sink == null) {
-                            onTimeout(rh);
-                        }
-                        sink.send(req);
-                        rh.transmitTask = null;
+            @Override
+            public void transmit(Connection.MessageSink sink) {
+                if (sink == null) {
+                    onTimeout(rh);
+                }
+                sink.send(req);
+                rh.transmitTask = null;
 
-                        logger.debug("recv in notifyTransmitReady cb");
-                        rh.receiveTask = 
client.receive(deadline.getRemaining(), new MessageReceiver() {
-                            @Override
-                            public void process(GnunetMessage.Body msg) {
-                                rh.receiveTask = null;
-                                ResolverResponse gmsg = (ResolverResponse) msg;
-                                if (gmsg.responseBody != null) {
-                                    try {
-                                        InetAddress in_addr;
-                                        int len = 
gmsg.responseBody.addr.length;
-                                        if (len == 4 || len == 16) {
-                                            in_addr = 
InetAddress.getByAddress(gmsg.responseBody.addr);
-                                        } else {
-                                            throw new 
ProtocolViolation("malformed address message");
-                                        }
-
-                                        rh.cb.onAddress(in_addr);
-                                        rh.receiveTask = 
client.receive(deadline.getRemaining(), this);
-                                    } catch (UnknownHostException e) {
-                                        throw new ProtocolViolation("malformed 
address");
-                                    }
+                logger.debug("recv in notifyTransmitReady cb");
+                rh.receiveTask = client.receive(deadline.getRemaining(), new 
MessageReceiver() {
+                    @Override
+                    public void process(GnunetMessage.Body msg) {
+                        rh.receiveTask = null;
+                        ResolverResponse gmsg = (ResolverResponse) msg;
+                        if (gmsg.responseBody != null) {
+                            try {
+                                InetAddress in_addr;
+                                int len = gmsg.responseBody.addr.length;
+                                if (len == 4 || len == 16) {
+                                    in_addr = 
InetAddress.getByAddress(gmsg.responseBody.addr);
                                 } else {
-                                    resolveActive = false;
-                                    rh.cb.onFinished();
-                                    handleNextRequest();
+                                    throw new ProtocolViolation("malformed 
address message");
                                 }
-                            }
 
-                            @Override
-                            public void handleError() {
-                                onTimeout(rh);
+                                rh.cb.onAddress(in_addr);
+                                rh.receiveTask = 
client.receive(deadline.getRemaining(), this);
+                            } catch (UnknownHostException e) {
+                                throw new ProtocolViolation("malformed 
address");
                             }
-                        });
-
+                        } else {
+                            resolveActive = false;
+                            rh.cb.onFinished();
+                            handleNextRequest();
+                        }
                     }
 
                     @Override
                     public void handleError() {
-                        throw new RuntimeException("unexpected transmit 
error");
+                        onTimeout(rh);
                     }
                 });
+
+            }
+
+            @Override
+            public void handleError() {
+                throw new RuntimeException("unexpected transmit error");
+            }
+        });
     }
 
 

Modified: gnunet-java/src/org/gnunet/util/Scheduler.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Scheduler.java      2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/util/Scheduler.java      2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -63,6 +63,7 @@
 
     private static Selector selector = null;
 
+
     static {
         try {
             selector = SelectorProvider.provider().openSelector();
@@ -437,6 +438,15 @@
     /**
      * Initialize and run scheduler. This function will return when all tasks
      * have completed.
+     */
+    public static void run() {
+        run(null);
+    }
+
+
+    /**
+     * Initialize and run scheduler. This function will return when all tasks
+     * have completed.
      *
      * @param initialTask the initial task to run immediately
      */

Modified: gnunet-java/src/org/gnunet/util/Server.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Server.java 2012-06-12 23:01:39 UTC (rev 
21937)
+++ gnunet-java/src/org/gnunet/util/Server.java 2012-06-13 00:03:56 UTC (rev 
21938)
@@ -131,7 +131,7 @@
          * for a while.  Only applies to the current message.
          */
         public void disableReceiveDoneWarning() {
-
+            // todo
         }
 
         public void keep() {
@@ -144,6 +144,10 @@
                 disconnect();
             }
         }
+
+        public void markMonitor() {
+            // todo
+        }
     }
 
 

Deleted: gnunet-java/src/org/gnunet/util/Service.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Service.java        2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/src/org/gnunet/util/Service.java        2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -1,51 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2011, 2012 Christian Grothoff (and other contributing authors)
-
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-package org.gnunet.util;
-
-
-/**
- * Server the entry point class for every gnunet-java component providing 
services
- * to other components.
- *
- */
-public abstract class Service extends Program {
-    private Server s;
-    
-    public Service(String[] args) {
-        super(args);
-        // now create the server:
-        // s = new Server()
-    }
-    
-    public final Server getServer() {
-        return s;
-    }
-
-    public final void stop() {
-
-    }
-
-    /**
-     * Override to implement the behavior of the Program.
-     */
-    public abstract void run();
-
-}

Added: gnunet-java/src/org/gnunet/util/Service.java
===================================================================
--- gnunet-java/src/org/gnunet/util/Service.java                                
(rev 0)
+++ gnunet-java/src/org/gnunet/util/Service.java        2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -0,0 +1,52 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.util;
+
+
+/**
+ * Server the entry point class for every gnunet-java component providing 
services
+ * to other components.
+ */
+public abstract class Service extends Program {
+    private Server s;
+    
+    public Service(String[] args) {
+        super(args);
+        // now create the server:
+        // s = new Server()
+
+        // todo: install signal handling pipe
+    }
+    
+    public final Server getServer() {
+        return s;
+    }
+
+    public final void stop() {
+
+    }
+
+    /**
+     * Override to implement the behavior of the Program.
+     */
+    public abstract void run();
+
+}

Modified: gnunet-java/test/org/gnunet/core/CoreTest.java
===================================================================
--- gnunet-java/test/org/gnunet/core/CoreTest.java      2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/test/org/gnunet/core/CoreTest.java      2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -21,6 +21,8 @@
 package org.gnunet.core;
 
 
+import org.gnunet.testing.TestingSetup;
+import org.gnunet.testing.TestingSubsystem;
 import org.gnunet.util.*;
 import org.grothoff.Runabout;
 import org.junit.Assert;
@@ -29,72 +31,76 @@
 import static org.junit.Assert.assertTrue;
 
 public class CoreTest {
-    @Test
+    TestingSetup testing = new TestingSetup();
+
+    @Test(timeout = 500)
     public void test_core_init() {
 
+        TestingSubsystem ts = testing.startSubsystem("core");
+
         final Wrapper<Boolean> res = new Wrapper<Boolean>(false);
 
-        new Program(new String[]{}) {
+        final Core core = new Core(ts.getConfiguration());
+        core.observeConnect(new ConnectHandler() {
             @Override
-            public void run() {
-                final Core core = new Core(getConfiguration());
-                core.observeConnect(new ConnectHandler() {
-                    @Override
-                    public void onConnect(PeerIdentity peerIdentity) {
-                        System.out.println("got connect!");
-                    }
-                });
-                core.init(new InitCallback() {
-                    @Override
-                    public void onInit(PeerIdentity myIdentity) {
-                        res.value = true;
-                        assertTrue(myIdentity != null);
-                        core.disconnect();
-                    }
-                });
+            public void onConnect(PeerIdentity peerIdentity) {
+                System.out.println("got connect!");
             }
-        }.start();
+        });
+        core.init(new InitCallback() {
+            @Override
+            public void onInit(PeerIdentity myIdentity) {
+                res.value = true;
+                assertTrue(myIdentity != null);
+                core.disconnect();
+            }
+        });
 
+
+        Scheduler.run();
+
         assertTrue(res.value);
     }
 
 
     @Test(timeout = 5000)
     public void test_core_echo() {
+
+        TestingSubsystem ts = testing.startSubsystem("core");
+
         final Wrapper<Boolean> gotResponse = new Wrapper<Boolean>(false);
-        new Program(new String[]{}) {
+
+        final Core core = new Core(ts.getConfiguration());
+        core.setMessageHandler(new Runabout() {
+            public void visit(TESTMessage t) {
+                System.out.println("got TEST message");
+                gotResponse.set(true);
+                core.disconnect();
+            }
+        });
+
+        core.init(new InitCallback() {
             @Override
-            public void run() {
-                final Core core = new Core(getConfiguration());
-                core.setMessageHandler(new Runabout() {
-                    public void visit(TESTMessage t) {
-                        System.out.println("got TEST message");
-                        gotResponse.set(true);
-                        core.disconnect();
+            public void onInit(PeerIdentity myIdentity) {
+                System.out.println("hi, init callback");
+                core.notifyTransmitReady(0, RelativeTime.FOREVER, myIdentity, 
4, new MessageTransmitter() {
+                    @Override
+                    public void transmit(Connection.MessageSink sink) {
+                        System.out.println("in transmit!");
+                        sink.send(new TESTMessage());
                     }
-                });
 
-                core.init(new InitCallback() {
                     @Override
-                    public void onInit(PeerIdentity myIdentity) {
-                        System.out.println("hi, init callback");
-                        core.notifyTransmitReady(0, RelativeTime.FOREVER, 
myIdentity, 4, new MessageTransmitter() {
-                            @Override
-                            public void transmit(Connection.MessageSink sink) {
-                                System.out.println("in transmit!");
-                                sink.send(new TESTMessage());
-                            }
-
-                            @Override
-                            public void handleError() {
-                                Assert.fail();
-                            }
-                        });
+                    public void handleError() {
+                        Assert.fail();
                     }
                 });
             }
-        }.start();
+        });
 
+        Scheduler.run();
+
         assertTrue(gotResponse.get());
+
     }
 }

Modified: gnunet-java/test/org/gnunet/dht/DHTTest.java
===================================================================
--- gnunet-java/test/org/gnunet/dht/DHTTest.java        2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/test/org/gnunet/dht/DHTTest.java        2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -21,6 +21,8 @@
 package org.gnunet.dht;
 
 import junit.framework.Assert;
+import org.gnunet.testing.TestingSetup;
+import org.gnunet.testing.TestingSubsystem;
 import org.gnunet.util.*;
 import org.junit.Test;
 
@@ -30,20 +32,25 @@
     @Test
     public void test_dht_put() {
         final Wrapper<Boolean> putFinished = new Wrapper<Boolean>(true);
-        new Program(new String[0]) {
+
+
+        TestingSetup testing = new TestingSetup();
+
+        TestingSubsystem ts = testing.startSubsystem("dht");
+
+        final DistributedHashTable dht = new 
DistributedHashTable(ts.getConfiguration());
+        dht.put(new HashCode("gnj-test"), new byte[]{1, 2, 3}, 1, 
EnumSet.noneOf(RouteOption.class),
+                BlockType.TEST.val, RelativeTime.HOUR.toAbsolute(), 
RelativeTime.FOREVER, new Continuation() {
             @Override
-            public void run() {
-                final DistributedHashTable dht = new 
DistributedHashTable(getConfiguration());
-                dht.put(new HashCode("gnj-test"), new byte[]{1,2,3}, 1, 
EnumSet.noneOf(RouteOption.class),
-                        BlockType.TEST.val, RelativeTime.HOUR.toAbsolute(), 
RelativeTime.FOREVER, new Continuation() {
-                    @Override
-                    public void cont(boolean success) {
-                        putFinished.set(true);
-                        dht.destroy();
-                    }
-                });
+            public void cont(boolean success) {
+                putFinished.set(true);
+                dht.destroy();
             }
-        }.start();
+        });
         Assert.assertTrue(putFinished.get());
+        Scheduler.run();
+
     }
+
 }
+

Modified: gnunet-java/test/org/gnunet/statistics/StatisticsTest.java
===================================================================
--- gnunet-java/test/org/gnunet/statistics/StatisticsTest.java  2012-06-12 
23:01:39 UTC (rev 21937)
+++ gnunet-java/test/org/gnunet/statistics/StatisticsTest.java  2012-06-13 
00:03:56 UTC (rev 21938)
@@ -20,19 +20,16 @@
 
 package org.gnunet.statistics;
 
-import com.google.common.io.ByteStreams;
-import com.google.common.io.Files;
-import com.google.common.io.InputSupplier;
+import junit.framework.Assert;
+import org.gnunet.testing.TestingSetup;
+import org.gnunet.testing.TestingSubsystem;
 import org.gnunet.util.*;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
 public class StatisticsTest {
-    // todo: load configuration and start service in fixup / @Before
+    TestingSetup testing = new TestingSetup();
 
+
     public interface Next {
         void next();
     }
@@ -65,97 +62,148 @@
         );
     }
 
+
     @Test
+    public void test_simple() {
+        final TestingSubsystem ts = testing.startSubsystem("statistics");
+
+        final Statistics stat = new Statistics(ts.getConfiguration());
+
+        final Wrapper<Boolean> contReached = new Wrapper<Boolean>(false);
+
+        stat.set("gnj-test", "test", 42, false);
+
+        stat.get(RelativeTime.FOREVER, "gnj-test", "test",
+                new StatisticsReceiver() {
+                    @Override
+                    public void onReceive(String subsystem, String name, long 
value) {
+                        Assert.assertEquals("gnj-test", subsystem);
+                        Assert.assertEquals("test", name);
+                        Assert.assertEquals(42, value);
+                        System.out.println("got values");
+                    }
+                }, new Continuation() {
+                    @Override
+                    public void cont(boolean success) {
+                        contReached.set(true);
+                        Assert.assertTrue(success);
+                        stat.destroy();
+                    }
+                }
+        );
+
+        Scheduler.run();
+
+        Assert.assertTrue(contReached.get());
+    }
+
+    @Test
     public void test_statistics_get_set() {
+        final TestingSubsystem ts = testing.startSubsystem("statistics");
+
         final AssertionList assertions = new AssertionList();
 
-        new Program(new String[]{}) {
-            @Override
-            public void run() {
-                final Statistics stat1 = new Statistics(cfg);
 
-                stat1.set("gnj-test", "test1", 5, false);
-                stat1.set("gnj-test", "test2", 7, true);
+        final Statistics stat1 = new Statistics(ts.getConfiguration());
 
-                stat1.set("gnj-test", "test3", 0, true);
-                stat1.update("gnj-test", "test3", 5, true);
-                stat1.update("gnj-test", "test3", -1, true);
+        stat1.set("gnj-test", "test1", 5, false);
+        stat1.set("gnj-test", "test2", 7, true);
 
-                stat1.destroy();
+        stat1.set("gnj-test", "test3", 0, true);
+        stat1.update("gnj-test", "test3", 5, true);
+        stat1.update("gnj-test", "test3", -1, true);
 
-                System.out.println("starting get tests");
+        stat1.destroy();
 
-                final Statistics stat2 = new Statistics(cfg);
+        System.out.println("starting get tests");
 
-                assertStatisticsGet(assertions, stat2, "gnj-test", "test1", 5, 
new Next() {
+        final Statistics stat2 = new Statistics(ts.getConfiguration());
+
+        assertStatisticsGet(assertions, stat2, "gnj-test", "test1", 5, new 
Next() {
+            @Override
+            public void next() {
+                assertStatisticsGet(assertions, stat2, "gnj-test", "test2", 7, 
new Next() {
                     @Override
                     public void next() {
-                        assertStatisticsGet(assertions, stat2, "gnj-test", 
"test2", 7, new Next() {
+                        assertStatisticsGet(assertions, stat2, "gnj-test", 
"test3", 4, new Next() {
                             @Override
                             public void next() {
-                                assertStatisticsGet(assertions, stat2, 
"gnj-test", "test3", 4, new Next() {
-                                    @Override
-                                    public void next() {
-                                        stat2.destroy();
-                                        System.out.println("destroy called");
-                                    }
-                                });
+                                stat2.destroy();
+                                System.out.println("destroy called");
                             }
                         });
-
                     }
                 });
+
             }
-        }.start();
+        });
 
+        Scheduler.run();
+
         assertions.assertAll();
-
-
     }
 
 
-    @Test
+    @Test(timeout = 1000)
     public void test_watch() {
-        Program.configureLogging(null, null);
-        Configuration cfg = new Configuration();
-        File f;
-        try {
-            f = File.createTempFile("gnunet", "conf");
-        } catch (IOException e) {
-            throw new RuntimeException("could not create temp file", e);
-        }
-        final InputStream stream = 
StatisticsTest.class.getResourceAsStream("/org/gnunet/statistics/statistics-test.conf");
-        if (stream == null) {
-            throw new RuntimeException("could not find resource");
-        }
+        final TestingSubsystem ts = testing.startSubsystem("statistics");
 
-        try {
-            Files.copy(new InputSupplier<InputStream>() {
-                @Override
-                public InputStream getInput() throws IOException {
-                    return stream;
-                }
-            }, f);
-        } catch (IOException e) {
-            throw new RuntimeException("could not copy config file", e);
-        }
+        final Wrapper<Integer> updates = new Wrapper<Integer>(0);
 
-        Process p;
+        final Statistics stat = new Statistics(ts.getConfiguration());
 
-        try {
-            p = Runtime.getRuntime().exec(new 
String[]{"gnunet-service-statistics", "-LDEBUG", "-c", f.getAbsolutePath()});
-        } catch (IOException e) {
-            throw new RuntimeException("could not start process", e);
-        }
+        Scheduler.addDelayed(new RelativeTime(100), new Scheduler.Task() {
+            @Override
+            public void run(Scheduler.RunContext ctx) {
+                stat.set("gnj-test", "test", 42, false);
+            }
+        });
 
-        try {
-            ByteStreams.copy(p.getErrorStream(), System.out);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        Scheduler.addDelayed(new RelativeTime(200), new Scheduler.Task() {
+            @Override
+            public void run(Scheduler.RunContext ctx) {
+                stat.set("gnj-test", "test", 43, false);
+            }
+        });
 
-        p.destroy();
+        Scheduler.addDelayed(new RelativeTime(300), new Scheduler.Task() {
+            @Override
+            public void run(Scheduler.RunContext ctx) {
+                ts.restart();
+            }
+        });
 
+        Scheduler.addDelayed(new RelativeTime(500), new Scheduler.Task() {
+            @Override
+            public void run(Scheduler.RunContext ctx) {
+                ts.restart();
+                System.out.println("restarted!!!!!");
+                stat.set("gnj-test", "test", 43, false);
+            }
+        });
 
+        Scheduler.addDelayed(new RelativeTime(600), new Scheduler.Task() {
+            @Override
+            public void run(Scheduler.RunContext ctx) {
+                ts.restart();
+                stat.set("gnj-test", "test", 42, false);
+            }
+        });
+
+
+        stat.watch("gnj-test", "test", new StatisticsReceiver() {
+            @Override
+            public void onReceive(String subsystem, String name, long value) {
+                updates.set(updates.get() + 1);
+                if (updates.get() == 4) {
+                    stat.destroy();
+                }
+            }
+        });
+
+        Scheduler.run();
+
+        Assert.assertEquals(4, updates.get().intValue());
+
     }
 }

Deleted: gnunet-java/test/org/gnunet/statistics/statistics-test.conf
===================================================================
--- gnunet-java/test/org/gnunet/statistics/statistics-test.conf 2012-06-12 
23:01:39 UTC (rev 21937)
+++ gnunet-java/test/org/gnunet/statistics/statistics-test.conf 2012-06-13 
00:03:56 UTC (rev 21938)
@@ -1,18 +0,0 @@
-[statistics]
-PORT = 3088
-HOSTNAME = localhost
-BINARY = gnunet-service-statistics
-ACCEPT_FROM = 127.0.0.1;
-ACCEPT_FROM6 = ::1;
-UNIX_MATCH_UID = NO
-UNIX_MATCH_GID = YES
-# DISABLE_SOCKET_FORWARDING = NO
-# USERNAME =
-# MAXBUF =
-# TIMEOUT =
-# DISABLEV6 =
-# BINDTO =
-# REJECT_FROM =
-# REJECT_FROM6 =
-# PREFIX =
-

Added: gnunet-java/test/org/gnunet/testing/TestingSetupTest.java
===================================================================
--- gnunet-java/test/org/gnunet/testing/TestingSetupTest.java                   
        (rev 0)
+++ gnunet-java/test/org/gnunet/testing/TestingSetupTest.java   2012-06-13 
00:03:56 UTC (rev 21938)
@@ -0,0 +1,54 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnunet.testing;
+
+import org.junit.Test;
+
+/**
+ * @author Florian Dold
+ */
+public class TestingSetupTest {
+    @Test
+    public void test_testing() {
+        // could be any service, just use statistics
+        TestingSetup testing = new TestingSetup();
+        TestingSubsystem ts = testing.startSubsystem("statistics");
+        String port = ts.getConfiguration().getValueString("statistics", 
"PORT");
+        org.junit.Assert.assertTrue(port != null);
+
+        ts.destroy();
+    }
+
+    @Test(expected = TestingSetup.SetupException.class)
+    public void test_no_service() {
+        TestingSetup testing = new TestingSetup();
+        TestingSubsystem ts = testing.startSubsystem("foobar _ !!!");
+    }
+
+    @Test
+    public void test_restart() {
+        // could be any service, just use statistics
+        TestingSetup testing = new TestingSetup();
+        TestingSubsystem ts = testing.startSubsystem("statistics");
+        ts.restart();
+        ts.destroy();
+    }
+}

Modified: gnunet-java/test/org/gnunet/util/ResolverTest.java
===================================================================
--- gnunet-java/test/org/gnunet/util/ResolverTest.java  2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/test/org/gnunet/util/ResolverTest.java  2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -20,6 +20,8 @@
 
 package org.gnunet.util;
 
+import org.gnunet.testing.TestingSetup;
+import org.gnunet.testing.TestingSubsystem;
 import org.junit.Test;
 
 import java.net.InetAddress;
@@ -28,7 +30,6 @@
 import static org.junit.Assert.fail;
 
 /**
- *
  * @author Florian Dold
  */
 public class ResolverTest {
@@ -37,48 +38,53 @@
         final Wrapper<Boolean> finished1 = new Wrapper<Boolean>(true);
         final Wrapper<Boolean> finished2 = new Wrapper<Boolean>(true);
 
-        new Program(new String[0]) {
+        TestingSetup testing = new TestingSetup();
+
+        TestingSubsystem ts = testing.startSubsystem("resolver");
+
+
+        Resolver r = Resolver.getInstance();
+        r.setConfiguration(ts.getConfiguration());
+
+        r.resolveHostname("gnunet.org", RelativeTime.FOREVER, new 
Resolver.AddressCallback() {
             @Override
-            public void run() {
-                Resolver r = Resolver.getInstance();
-                r.resolveHostname("gnunet.org", RelativeTime.FOREVER, new 
Resolver.AddressCallback() {
-                    @Override
-                    public void onAddress(InetAddress addr) {
-                        System.out.println(addr.getHostAddress());
-                    }
+            public void onAddress(InetAddress addr) {
+                System.out.println(addr.getHostAddress());
+            }
 
-                    @Override
-                    public void onFinished() {
-                        finished1.set(true);
-                    }
+            @Override
+            public void onFinished() {
+                finished1.set(true);
+            }
 
-                    @Override
-                    public void onTimeout() {
-                        fail();
-                    }
-                });
-                r.resolveHostname("gnu.org", RelativeTime.FOREVER, new 
Resolver.AddressCallback() {
-                    @Override
-                    public void onAddress(InetAddress addr) {
-                        System.out.println(addr.getHostAddress());
-                    }
+            @Override
+            public void onTimeout() {
+                fail();
+            }
+        });
+        r.resolveHostname("gnu.org", RelativeTime.FOREVER, new 
Resolver.AddressCallback() {
+            @Override
+            public void onAddress(InetAddress addr) {
+                System.out.println(addr.getHostAddress());
+            }
 
-                    @Override
-                    public void onFinished() {
-                        finished2.set(true);
-                    }
+            @Override
+            public void onFinished() {
+                finished2.set(true);
+            }
 
-                    @Override
-                    public void onTimeout() {
-                        fail();
-                    }
-                });
+            @Override
+            public void onTimeout() {
+                fail();
             }
-        }.start();
+        });
 
+        Scheduler.run();
+
         assertTrue(finished1.get());
+
         assertTrue(finished2.get());
-
     }
 
 }
+

Deleted: gnunet-java/test/org/gnunet/util/TestingSetup.java
===================================================================
--- gnunet-java/test/org/gnunet/util/TestingSetup.java  2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/test/org/gnunet/util/TestingSetup.java  2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -1,28 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2011, 2012 Christian Grothoff (and other contributing authors)
-
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-package org.gnunet.util;
-
-/**
- * @author Florian Dold
- */
-public class TestingSetup {
-
-}

Modified: gnunet-java/test/org/gnunet/util/getopt/GetoptTest.java
===================================================================
--- gnunet-java/test/org/gnunet/util/getopt/GetoptTest.java     2012-06-12 
23:01:39 UTC (rev 21937)
+++ gnunet-java/test/org/gnunet/util/getopt/GetoptTest.java     2012-06-13 
00:03:56 UTC (rev 21938)
@@ -69,7 +69,6 @@
 }
 
 public class GetoptTest {
-
     @Test
     public void test_str() {
         Target t = new Target();

Modified: gnunet-java/test/org/org/gnunet/nse/NSETest.java
===================================================================
--- gnunet-java/test/org/org/gnunet/nse/NSETest.java    2012-06-12 23:01:39 UTC 
(rev 21937)
+++ gnunet-java/test/org/org/gnunet/nse/NSETest.java    2012-06-13 00:03:56 UTC 
(rev 21938)
@@ -21,12 +21,16 @@
 package org.org.gnunet.nse;
 
 import org.gnunet.nse.NetworkSizeEstimation;
+import org.gnunet.testing.TestingSetup;
+import org.gnunet.testing.TestingSubsystem;
 import org.gnunet.util.AbsoluteTime;
-import org.gnunet.util.Program;
+import org.gnunet.util.Scheduler;
 import org.gnunet.util.Wrapper;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 /**
  * @author Florian Dold
  */
@@ -34,20 +38,21 @@
     @Test
     public void test_nse() {
         final Wrapper<Boolean> gotResult = new Wrapper<Boolean>(false);
-        new Program(new String[0]) {
+        TestingSetup testing = new TestingSetup();
+        TestingSubsystem ts = testing.startSubsystem("nse");
+
+        final NetworkSizeEstimation nse = new 
NetworkSizeEstimation(ts.getConfiguration());
+        nse.subscribe(new NetworkSizeEstimation.Subscriber() {
             @Override
-            public void run() {
-                final NetworkSizeEstimation nse = new 
NetworkSizeEstimation(getConfiguration());
-                nse.subscribe(new NetworkSizeEstimation.Subscriber() {
-                    @Override
-                    public void update(AbsoluteTime timestamp, double 
estimate, double deviation) {
-                        assertNotNull(timestamp);
-                        gotResult.set(true);
-                        nse.disconnect();
-                    }
-                });
+            public void update(AbsoluteTime timestamp, double estimate, double 
deviation) {
+                assertNotNull(timestamp);
+                gotResult.set(true);
+                nse.disconnect();
             }
-        }.start();
+        });
+
+        Scheduler.run();
+
         assertTrue(gotResult.get());
     }
 }

Modified: gnunet-java/tools/build
===================================================================
--- gnunet-java/tools/build     2012-06-12 23:01:39 UTC (rev 21937)
+++ gnunet-java/tools/build     2012-06-13 00:03:56 UTC (rev 21938)
@@ -15,7 +15,7 @@
 cd "$BASEDIR/src/"
 
 # collect resources from src/ and copy to build/
-find "." \( -name "*.txt" -o -name "*.properties" \) \
+find "." \( -name "*.txt" -o -name "*.properties" -o -name "*.conf" \) \
     -exec cp --parents '{}' "../build" \;
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]