diff --git a/HaskellTorrent.cabal b/HaskellTorrent.cabal
--- a/HaskellTorrent.cabal
+++ b/HaskellTorrent.cabal
@@ -1,6 +1,6 @@
 name: HaskellTorrent
 category: Network
-version: 0.1
+version: 0.1.1
 category: Network
 description:   HaskellTorrent provides a BitTorrent client, based on the CML library
                for concurrency. This is an early preview release which is capable of
@@ -41,7 +41,7 @@
     Process.PeerMgr, Process.Peer, Process.PieceMgr, Process.Status,
     Process.Timer, Process.Tracker,
     Digest, FS, PeerTypes, Process, RateCalc,
-    Supervisor, Torrent
+    Supervisor, Torrent, Test, TestInstance
 
   extensions: CPP
 
diff --git a/src/Test.hs b/src/Test.hs
new file mode 100644
--- /dev/null
+++ b/src/Test.hs
@@ -0,0 +1,30 @@
+{- The Test module provides an interface to test-framework. It is called when --tests
+ - is supplied on the command line. This file only gathers together various test suites
+ - from all over the rest of the code and then executes them via test-framework.
+ -}
+module Test (runTests) where
+
+import System.Environment ( getArgs )
+import Test.Framework
+import Test.Framework.Providers.QuickCheck2
+
+import qualified Protocol.BCode (testSuite)
+import qualified Protocol.Wire  (testSuite)
+
+
+runTests :: IO ()
+runTests =
+ do args <- filter (/= "--tests") `fmap` getArgs
+    flip defaultMainWithArgs args
+     [ testSuite
+     , Protocol.BCode.testSuite
+     , Protocol.Wire.testSuite
+     ]
+
+testSuite = testGroup "Test test-framework"
+ [ testProperty "reverse-reverse/id" prop_reversereverse ]
+
+-- reversing twice a finite list, is the same as identity
+prop_reversereverse s = (reverse . reverse) s == id s
+    where _ = s :: [Int]
+
diff --git a/src/TestInstance.hs b/src/TestInstance.hs
new file mode 100644
--- /dev/null
+++ b/src/TestInstance.hs
@@ -0,0 +1,50 @@
+-- Define a set of test instances of common things used in HaskellTorrent
+-- Portions of this code is taken from "Real World Haskell"
+module TestInstance
+    ()
+where
+
+import Data.Word
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Lazy as L
+
+import System.Random
+import Test.QuickCheck
+
+integralRandomR (a,b) g = case randomR (c,d) g of
+                            (x,h) -> (fromIntegral x, h)
+    where (c,d) = (fromIntegral a :: Integer,
+                   fromIntegral b :: Integer)
+
+instance Random Word32 where
+  randomR = integralRandomR
+  random = randomR (minBound, maxBound)
+
+instance Arbitrary Word32 where
+    arbitrary = arbitraryBoundedRandom
+
+instance CoArbitrary Word32 where
+    coarbitrary = coarbitraryIntegral
+
+instance Random Word8 where
+    randomR = integralRandomR
+    random = randomR (minBound, maxBound)
+
+instance Arbitrary Word8 where
+    arbitrary = arbitraryBoundedRandom
+
+instance CoArbitrary Word8 where
+    coarbitrary = coarbitraryIntegral
+
+instance Arbitrary L.ByteString where
+    arbitrary = L.pack `fmap` arbitrary
+
+instance CoArbitrary L.ByteString where
+    coarbitrary = coarbitrary . L.unpack
+
+instance Arbitrary B.ByteString where
+    arbitrary = B.pack `fmap` arbitrary
+
+instance CoArbitrary B.ByteString where
+    coarbitrary = coarbitrary . B.unpack
+
