@Test
public void testRelayPullerThreadV3WithFilter() throws Exception
{

  RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
  // create filter
  DbusKeyCompositeFilterConfig filterConfig = createFakeFilter();
  bldr.setFilterConfig(filterConfig);
  RelayPullThread relayPuller = bldr.createRelayPullThread();
  relayPuller.getComponentStatus().start();
  ConnectionState connState = relayPuller.getConnectionState();
  connState.switchToPickServer();
  testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
  // get the created connection
  MockRelayConnection conn = (MockRelayConnection) relayPuller.getLastOpenConnection();
  conn.setProtocolVersion(3);
  relayPuller.getMessageQueue().clear();
  testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
  relayPuller.getMessageQueue().clear();
  testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
  relayPuller.getMessageQueue().clear();
  testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
  relayPuller.getMessageQueue().clear();
  testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
  relayPuller.getMessageQueue().clear();
  testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);
  DbusKeyCompositeFilter filter = conn.getRelayFilter();
  Assert.assertNotNull(filter);
  // get DbusKeyFilter that we put in
  KeyFilterConfigHolder configHolder = filterConfig.getConfigMap().values().iterator().next();
  DbusKeyFilter inFilter = new DbusKeyFilter(configHolder);
  // get filter from the connection
  Assert.assertEquals(filter.getFilterMap().size(), 1, "1 filter in the composite filter");
  Assert.assertTrue(filter.getFilterMap().entrySet().iterator().hasNext(), "has one filter");
  DbusKeyFilter newFilter = filter.getFilterMap().values().iterator().next();
  //compare them
  boolean eq = inFilter.getPartitionType() == newFilter.getPartitionType() &&
      inFilter.getFilters().size() == newFilter.getFilters().size();
  Assert.assertTrue(eq, "Same Filter");
}