/**
   * Tests for proper linkage with methods of CoreConnectionItem that pull their data directly from
   * the routed connection.
   */
  public void testDelegateMethods() {
    final Mockery context = new Mockery();

    final RoutedConnection connection = context.mock(RoutedConnection.class);

    context.checking(
        new Expectations() {
          {
            allowing(connection).getMeasuredDownstreamBandwidth();
            will(returnValue(6523f));
            allowing(connection).getMeasuredUpstreamBandwidth();
            will(returnValue(6524f));

            ConnectionMessageStatistics messageStats =
                context.mock(ConnectionMessageStatistics.class);
            allowing(connection).getConnectionMessageStatistics();
            will(returnValue(messageStats));
            allowing(messageStats).getNumMessagesReceived();
            will(returnValue(6525));
            allowing(messageStats).getNumMessagesSent();
            will(returnValue(6526));
            allowing(messageStats).getNumReceivedMessagesDropped();
            will(returnValue(6527L));
            allowing(messageStats).getNumSentMessagesDropped();
            will(returnValue(6528));

            allowing(connection).getPort();
            will(returnValue(6529));

            ConnectionRoutingStatistics routingStats =
                context.mock(ConnectionRoutingStatistics.class);
            allowing(connection).getRoutedConnectionStatistics();
            will(returnValue(routingStats));
            allowing(routingStats).getQueryRouteTableEmptyUnits();
            will(returnValue(6530));
            allowing(routingStats).getQueryRouteTablePercentFull();
            will(returnValue(6531d));
            allowing(routingStats).getQueryRouteTableSize();
            will(returnValue(6532));
            allowing(routingStats).getQueryRouteTableUnitsInUse();
            will(returnValue(6533));

            ConnectionBandwidthStatistics bandwithStats =
                context.mock(ConnectionBandwidthStatistics.class);
            allowing(connection).getConnectionBandwidthStatistics();
            will(returnValue(bandwithStats));
            allowing(bandwithStats).getReadLostFromSSL();
            will(returnValue(6534f));
            allowing(bandwithStats).getReadSavedFromCompression();
            will(returnValue(6535f));
            allowing(bandwithStats).getSentLostFromSSL();
            will(returnValue(6536f));
            allowing(bandwithStats).getSentSavedFromCompression();
            will(returnValue(6537f));

            ConnectionCapabilities capabilities = context.mock(ConnectionCapabilities.class);
            allowing(connection).getConnectionCapabilities();
            will(returnValue(capabilities));
            allowing(capabilities).getUserAgent();
            will(returnValue("6538"));

            one(connection).isSupernodeClientConnection();
            will(returnValue(false));
            one(connection).isSupernodeClientConnection();
            will(returnValue(true));
            one(connection).isOutgoing();
            will(returnValue(false));
            one(connection).isOutgoing();
            will(returnValue(true));
            one(capabilities).isSupernodeSupernodeConnection();
            will(returnValue(false));
            one(capabilities).isSupernodeSupernodeConnection();
            will(returnValue(true));
            one(capabilities).isSupernodeConnection();
            will(returnValue(false));
            one(capabilities).isSupernodeConnection();
            will(returnValue(true));
            one(capabilities).isClientSupernodeConnection();
            will(returnValue(false));
            one(capabilities).isClientSupernodeConnection();
            will(returnValue(true));

            allowing(connection);
          }
        });

    CoreConnectionItem item = new CoreConnectionItem(connection);

    assertEquals(6523f, item.getMeasuredDownstreamBandwidth());
    assertEquals(6524f, item.getMeasuredUpstreamBandwidth());
    assertEquals(6525, item.getNumMessagesReceived());
    assertEquals(6526, item.getNumMessagesSent());
    assertEquals(6527L, item.getNumReceivedMessagesDropped());
    assertEquals(6528, item.getNumSentMessagesDropped());
    assertEquals(6529, item.getPort());
    assertEquals(6530, item.getQueryRouteTableEmptyUnits());
    assertEquals(6531d, item.getQueryRouteTablePercentFull());
    assertEquals(6532, item.getQueryRouteTableSize());
    assertEquals(6533, item.getQueryRouteTableUnitsInUse());
    assertEquals(6534f, item.getReadLostFromSSL());
    assertEquals(6535f, item.getReadSavedFromCompression());
    assertEquals(6536f, item.getSentLostFromSSL());
    assertEquals(6537f, item.getSentSavedFromCompression());
    assertEquals("6538", item.getUserAgent());

    assertFalse(item.isLeaf());
    assertFalse(item.isOutgoing());
    assertFalse(item.isPeer());
    assertFalse(item.isUltrapeerConnection());
    assertFalse(item.isUltrapeer());
    assertTrue(item.isLeaf());
    assertTrue(item.isOutgoing());
    assertTrue(item.isPeer());
    assertTrue(item.isUltrapeerConnection());
    assertTrue(item.isUltrapeer());
  }