diff --git a/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java b/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java
new file mode 100755
index 0000000..58e1ae7
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java
@@ -0,0 +1,113 @@
+package de.ids_mannheim.korap.utils;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * User: hanl
+ * Date: 9/13/13
+ * Time: 2:25 PM
+ *
+ * currently only supports IPv4!
+ *
+ */
+// todo: integrate to gerrit
+public class IPNetMask {
+
+    private final Inet4Address i4addr;
+    private final byte maskCtr;
+
+    private final int addrInt;
+    private final int maskInt;
+
+    private static final int default_mask = 16;
+
+    private IPNetMask(Inet4Address i4addr, byte mask) {
+        this.i4addr = i4addr;
+        this.maskCtr = mask;
+
+        this.addrInt = addrToInt(i4addr);
+        this.maskInt = ~((1 << (32 - maskCtr)) - 1);
+    }
+
+    /**
+     * IPNetMask factory method.
+     *
+     * @param addrSlashMask IP/Mask String in format "nnn.nnn.nnn.nnn/mask". If
+     *                      the "/mask" is omitted, "/32" (just the single address) is assumed.
+     * @return a new IPNetMask
+     * @throws UnknownHostException if address part cannot be parsed by
+     *                              InetAddress
+     */
+    public static IPNetMask getIPMask(String addrSlashMask)
+            throws UnknownHostException {
+        int pos = addrSlashMask.indexOf('/');
+        String addr;
+        byte maskCtr;
+        if (pos == -1) {
+            addr = addrSlashMask;
+            maskCtr = default_mask;
+        } else {
+            addr = addrSlashMask.substring(0, pos);
+            maskCtr = Byte.parseByte(addrSlashMask.substring(pos + 1));
+        }
+
+        return new IPNetMask((Inet4Address) InetAddress.getByName(addr), maskCtr);
+    }
+
+    /**
+     * Test given IPv4 address against this IPNetMask object.
+     *
+     * @param testAddr address to isSystem.
+     * @return true if address is in the IP Mask range, false if not.
+     */
+    public boolean matches(Inet4Address testAddr) {
+        int testAddrInt = addrToInt(testAddr);
+        return ((addrInt & maskInt) == (testAddrInt & maskInt));
+    }
+
+    /**
+     * Convenience method that converts String host to IPv4 address.
+     *
+     * @param addr IP address to match in nnn.nnn.nnn.nnn format or hostname.
+     * @return true if address is in the IP Mask range, false if not.
+     * @throws UnknownHostException if the string cannot be decoded.
+     */
+    public boolean matches(String addr)
+            throws UnknownHostException {
+        return matches((Inet4Address) InetAddress.getByName(addr));
+    }
+
+    /**
+     * Converts IPv4 address to integer representation.
+     */
+    private int addrToInt(Inet4Address i4addr) {
+        byte[] ba = i4addr.getAddress();
+        return (ba[0] << 24)
+                | ((ba[1] & 0xFF) << 16)
+                | ((ba[2] & 0xFF) << 8)
+                | (ba[3] & 0xFF);
+    }
+
+    @Override
+    public String toString() {
+        return i4addr.getHostAddress() + "/" + maskCtr;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final IPNetMask that = (IPNetMask) obj;
+        return (this.addrInt == that.addrInt && this.maskInt == that.maskInt);
+    }
+
+    @Override
+    public int hashCode() {
+        return this.maskInt + this.addrInt;
+    }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index b77e4be..aea8280 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -5,10 +5,10 @@
 import com.sun.jersey.api.core.DefaultResourceConfig;
 import com.sun.jersey.spi.inject.SingletonTypeInjectableProvider;
 import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.WebAppDescriptor;
+import com.sun.jersey.test.framework.LowLevelAppDescriptor;
 import com.sun.jersey.test.framework.spi.container.TestContainer;
 import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+import com.sun.jersey.test.framework.spi.container.grizzly.GrizzlyTestContainerFactory;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -69,13 +69,12 @@
 
     public static void initServer() {
 
-        //        AppDescriptor ad = new LowLevelAppDescriptor.Builder(resourceConfig)
-        //                .build();
-        AppDescriptor ad = new WebAppDescriptor.Builder().build();
+                AppDescriptor ad = new LowLevelAppDescriptor.Builder(resourceConfig)
+                        .build();
 
         TestContainerFactory tcf = testContainerFactory;
         if (tcf == null) {
-            tcf = new GrizzlyWebTestContainerFactory();
+            tcf = new GrizzlyTestContainerFactory();
         }
         testContainer = tcf
                 .create(UriBuilder.fromUri("http://localhost/").port(9998)
