diff --git a/.gitattributes b/.gitattributes
index 063b6ad220753cf52135332ce49e14989c8241e9..b9542693c0c0baf47e7c8d712b75a35d1ac5bb65 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3956,6 +3956,7 @@ RTCP/Cobalt/InputProc/src/obsolete/Poll.h -text
 RTCP/Cobalt/InputProc/src/obsolete/TimeSync.h -text
 RTCP/Cobalt/InputProc/test/CMakeLists.txt -text
 RTCP/Cobalt/InputProc/test/tGenerator.cc -text
+RTCP/Cobalt/InputProc/test/tPacketFactory.cc -text
 RTCP/Cobalt/InputProc/test/tPacketReader.cc -text
 RTCP/Cobalt/InputProc/test/tPacketReader.in_16bit -text
 RTCP/Cobalt/InputProc/test/tPacketReader.in_8bit -text
diff --git a/RTCP/Cobalt/InputProc/test/CMakeLists.txt b/RTCP/Cobalt/InputProc/test/CMakeLists.txt
index 9187efd791f1b8fb05102882f6e0cf049b2b5c6e..d008fd7725fbde602edec7932fbda39b32b925a3 100644
--- a/RTCP/Cobalt/InputProc/test/CMakeLists.txt
+++ b/RTCP/Cobalt/InputProc/test/CMakeLists.txt
@@ -15,6 +15,7 @@ endif(UNITTEST++_FOUND)
 lofar_add_test(tRSP tRSP.cc)
 lofar_add_test(tRSPTimeStamp2 tRSPTimeStamp2.cc)
 lofar_add_test(tPacketReader tPacketReader.cc)
+lofar_add_test(tPacketFactory tPacketFactory.cc)
 lofar_add_test(tGenerator tGenerator.cc)
 
 lofar_add_test(tPacketWriter tPacketWriter.cc)
diff --git a/RTCP/Cobalt/InputProc/test/tGenerator.cc b/RTCP/Cobalt/InputProc/test/tGenerator.cc
index db27228b007128d2cdc2465a23587462ac6829df..bf2e98a963c8e8178bbf03eeddc71f4114c9cf12 100644
--- a/RTCP/Cobalt/InputProc/test/tGenerator.cc
+++ b/RTCP/Cobalt/InputProc/test/tGenerator.cc
@@ -30,6 +30,7 @@
 #include <CoInterface/Stream.h>
 
 #include <OMPThread.h>
+#include <Station/PacketFactory.h>
 #include <Station/Generator.h>
 #include <Station/PacketReader.h>
 
@@ -57,7 +58,8 @@ int main( int, char **argv )
   struct StationID stationID("RS106", "LBA", 200, 16);
   struct BufferSettings settings(stationID, false);
 
-  Generator g(settings, streamDescs);
+  PacketFactory factory(settings);
+  Generator g(settings, streamDescs, factory);
 
   bool error = false;
 
diff --git a/RTCP/Cobalt/InputProc/test/tPacketFactory.cc b/RTCP/Cobalt/InputProc/test/tPacketFactory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eb18375eea199e5ca0c9f971b8e53cd8b56c03d1
--- /dev/null
+++ b/RTCP/Cobalt/InputProc/test/tPacketFactory.cc
@@ -0,0 +1,71 @@
+
+/* tPacketFactory.cc
+ * Copyright (C) 2012-2013  ASTRON (Netherlands Institute for Radio Astronomy)
+ * P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
+ *
+ * This file is part of the LOFAR software suite.
+ * The LOFAR software suite 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 of the License, or
+ * (at your option) any later version.
+ *
+ * The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * $Id: $
+ */
+
+#include <lofar_config.h>
+
+#include <Buffer/BufferSettings.h>
+#include <Station/PacketFactory.h>
+#include <time.h>
+
+using namespace LOFAR;
+using namespace Cobalt;
+
+void test()
+{
+  struct StationID stationID("RS106", "LBA", 200, 16);
+  struct BufferSettings settings(stationID, false);
+  PacketFactory factory(settings);
+
+  // Just generate packets.
+  time_t now = time(0);
+  TimeStamp start(now,     0, stationID.clockMHz * 1000000);
+  TimeStamp end  (now + 1, 0, stationID.clockMHz * 1000000);
+
+  // The number of time slots per packet, which will
+  // be read from the generated packets.
+  size_t timesPerPacket = 16;
+
+  for (TimeStamp i = start; i < end; i += timesPerPacket) {
+    struct RSP packet;
+
+    factory.makePacket(packet, i, 0);
+    timesPerPacket = packet.header.nrBlocks;
+
+    // Basic sanity checks
+    ASSERT(packet.packetSize() <= sizeof packet);
+    ASSERT(packet.timeStamp() == i);
+
+    // Prevent infinite loops
+    ASSERT(timesPerPacket > 0);
+  }
+}
+
+int main( int, char **argv )
+{
+  INIT_LOGGER( "tPacketFactory" );
+
+  // Don't run forever if communication fails for some reason
+  alarm(10);
+
+  test();
+}
+