### Question:
OFStatisticsFuture extends
        OFMessageFuture<List<OFStatistics>> { public OFStatisticsFuture(IThreadPoolService tp, IOFSwitch sw, int transactionId) { super(tp, sw, OFType.STATS_REPLY, transactionId); init(); } OFStatisticsFuture(IThreadPoolService tp,
            IOFSwitch sw, int transactionId);  OFStatisticsFuture(IThreadPoolService tp,
            IOFSwitch sw, int transactionId, long timeout, TimeUnit unit);   }### Answer:
@Test public void testOFStatisticsFuture() throws Exception { IOFSwitch sw = createMock(IOFSwitch.class); sw.cancelStatisticsReply(1); OFStatisticsFuture sf = new OFStatisticsFuture(tp, sw, 1); replay(sw); List<OFStatistics> stats; FutureFetcher<List<OFStatistics>> ff = new FutureFetcher<List<OFStatistics>>(sf); Thread t = new Thread(ff); t.start(); sf.deliverFuture(sw, getStatisticsReply(1, 10, false)); t.join(); stats = ff.getValue(); verify(sw); assertEquals(10, stats.size()); reset(sw); sw.cancelStatisticsReply(1); sf = new OFStatisticsFuture(tp, sw, 1); replay(sw); ff = new FutureFetcher<List<OFStatistics>>(sf); t = new Thread(ff); t.start(); sf.deliverFuture(sw, getStatisticsReply(1, 10, true)); sf.deliverFuture(sw, getStatisticsReply(1, 5, false)); t.join(); stats = sf.get(); verify(sw); assertEquals(15, stats.size()); reset(sw); sw.cancelStatisticsReply(1); sf = new OFStatisticsFuture(tp, sw, 1); replay(sw); ff = new FutureFetcher<List<OFStatistics>>(sf); t = new Thread(ff); t.start(); sf.cancel(true); t.join(); stats = sf.get(); verify(sw); assertEquals(0, stats.size()); reset(sw); sw.cancelStatisticsReply(1); sf = new OFStatisticsFuture(tp, sw, 1, 75, TimeUnit.MILLISECONDS); replay(sw); ff = new FutureFetcher<List<OFStatistics>>(sf); t = new Thread(ff); t.start(); t.join(2000); stats = sf.get(); verify(sw); assertEquals(0, stats.size()); }