@Test
    public void WhenSerializingValidRoutingTable_ExpectResults() throws UnknownHostException {
        int levels = 2;
        int levelSize = 2;

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < levels; i++) {
            builder.append("0");
        }

        String expectedLocalIP = "127.0.0.1";
        int expectedLocalPort = 3000;
        String expectedLocalPath = builder.toString();
        String expectedLocalUUID = "12345678-1231-1234-1234-0123456789ad";
        long expectedLocalTS = 0;

        Host localhost = new PGridHost(expectedLocalIP, expectedLocalPort);
        localhost.setHostPath(expectedLocalPath);
        localhost.setUUID(UUID.fromString(expectedLocalUUID));
        localhost.resetTimestamp();
        RoutingTable routingTable = new RoutingTable();

        routingTable.setLocalhost(localhost);

        List<List<PeerReference>> expectedRefs = new ArrayList<List<PeerReference>>(levels);
        for (int i = 0; i < levels; i++) {
            List<PeerReference> levelList = new ArrayList<PeerReference>(levelSize);
            for (int j = 0; j < levelSize; j++) {
                PGridHost host = new PGridHost("127.0.0.1", (j + 1) * 1000);
                routingTable.addReference(i, host);
                levelList.add(new PeerReference(
                        host.getAddress().getHostAddress(),
                        host.getPort(),
                        host.getHostPath().toString(),
                        host.getTimestamp(),
                        host.getUUID().toString()));
            }
            expectedRefs.add(levelList);
        }

        CorbaRoutingTable corbaRoutingTable =
                Serializer.serializeRoutingTable(routingTable);

        PeerReference localRef = corbaRoutingTable.peer;
        Assert.assertTrue(localRef.address.compareTo(expectedLocalIP) == 0);
        Assert.assertTrue(localRef.port == expectedLocalPort);
        Assert.assertTrue(localRef.path.compareTo(expectedLocalPath) == 0);
        Assert.assertTrue(localRef.uuid.compareTo(expectedLocalUUID) == 0);
        Assert.assertTrue(localRef.timestamp == expectedLocalTS);

        PeerReference[][] references = corbaRoutingTable.refs;

        Assert.assertTrue(references.length == levels);
        for (int i = 0; i < references.length; i++) {
            Assert.assertTrue(references[i].length == levelSize);
            for (int j = 0; j < references[i].length; j++) {
                List<PeerReference> expectedLevel = expectedRefs.get(i);
                Assert.assertTrue(references[i].length == expectedLevel.size());
                for (PeerReference peer : expectedLevel) {
                    if (peer.uuid.compareTo(references[i][j].uuid) == 0) {
                        Assert.assertTrue(peer.address.compareTo(references[i][j].address) == 0);
                        Assert.assertTrue(peer.port == references[i][j].port);
                        Assert.assertTrue(peer.path.compareTo(references[i][j].path) == 0);
                        Assert.assertTrue(peer.uuid.compareTo(references[i][j].uuid) == 0);
                        Assert.assertTrue(peer.timestamp == references[i][j].timestamp);
                    }
                }
            }
        }
    }