@Test(timeout = 5000) public void testMessageWriteList() throws InterruptedException, ExecutionException { Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList(); OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of()); OFPacketOut packetOut = factory.buildPacketOut() .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 }) .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0))) .build(); conn.write(ImmutableList.of(hello, packetOut)); eventLoop.runTasks(); assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true)); List<OFMessage> value = cMsgList.getValue(); logger.info("Captured channel write: "+value); assertThat("Should have captured MsgList", cMsgList.getValue(), Matchers.<OFMessage> contains(hello, packetOut)); }
@Override public Collection<OFMessage> write(final Iterable<OFMessage> msgList) { if (!isConnected()) { if (logger.isDebugEnabled()) logger.debug(this.toString() + " : not connected - dropping {} element msglist {} ", Iterables.size(msgList), String.valueOf(msgList).substring(0, 80)); return IterableUtils.toCollection(msgList); } for (OFMessage m : msgList) { if (logger.isTraceEnabled()) { logger.trace("{}: send {}", this, m); counters.updateWriteStats(m); } } this.channel.eventLoop().execute(new WriteMessageTask(msgList)); return Collections.emptyList(); }
OFConnection implements IOFConnection, IOFConnectionBackend { @Override public Collection<OFMessage> write(final Iterable<OFMessage> msgList) { if (!isConnected()) { if (logger.isDebugEnabled()) logger.debug(this.toString() + " : not connected - dropping {} element msglist {} ", Iterables.size(msgList), String.valueOf(msgList).substring(0, 80)); return IterableUtils.toCollection(msgList); } for (OFMessage m : msgList) { if (logger.isTraceEnabled()) { logger.trace("{}: send {}", this, m); counters.updateWriteStats(m); } } this.channel.eventLoop().execute(new WriteMessageTask(msgList)); return Collections.emptyList(); } }
OFConnection implements IOFConnection, IOFConnectionBackend { @Override public Collection<OFMessage> write(final Iterable<OFMessage> msgList) { if (!isConnected()) { if (logger.isDebugEnabled()) logger.debug(this.toString() + " : not connected - dropping {} element msglist {} ", Iterables.size(msgList), String.valueOf(msgList).substring(0, 80)); return IterableUtils.toCollection(msgList); } for (OFMessage m : msgList) { if (logger.isTraceEnabled()) { logger.trace("{}: send {}", this, m); counters.updateWriteStats(m); } } this.channel.eventLoop().execute(new WriteMessageTask(msgList)); return Collections.emptyList(); } OFConnection(@Nonnull DatapathId dpid,
			@Nonnull OFFactory factory,
			@Nonnull Channel channel,
			@Nonnull OFAuxId auxId,
			@Nonnull IDebugCounterService debugCounters,
			@Nonnull Timer timer); }
OFConnection implements IOFConnection, IOFConnectionBackend { @Override public Collection<OFMessage> write(final Iterable<OFMessage> msgList) { if (!isConnected()) { if (logger.isDebugEnabled()) logger.debug(this.toString() + " : not connected - dropping {} element msglist {} ", Iterables.size(msgList), String.valueOf(msgList).substring(0, 80)); return IterableUtils.toCollection(msgList); } for (OFMessage m : msgList) { if (logger.isTraceEnabled()) { logger.trace("{}: send {}", this, m); counters.updateWriteStats(m); } } this.channel.eventLoop().execute(new WriteMessageTask(msgList)); return Collections.emptyList(); } OFConnection(@Nonnull DatapathId dpid,
			@Nonnull OFFactory factory,
			@Nonnull Channel channel,
			@Nonnull OFAuxId auxId,
			@Nonnull IDebugCounterService debugCounters,
			@Nonnull Timer timer); @Override Collection<OFMessage> write(final Iterable<OFMessage> msgList); @Override boolean write(OFMessage m); @Override ListenableFuture<R> writeRequest(OFRequest<R> request); @Override ListenableFuture<List<REPLY>> writeStatsRequest(
			OFStatsRequest<REPLY> request); void disconnected(); @Override void disconnect(); @Override String toString(); @Override Date getConnectedSince(); boolean handleGenericDeliverable(OFMessage reply); @Override void cancelAllPendingRequests(); @Override boolean isConnected(); @Override SocketAddress getRemoteInetAddress(); @Override SocketAddress getLocalInetAddress(); boolean deliverResponse(OFMessage m); @Override boolean isWritable(); @Override DatapathId getDatapathId(); @Override OFAuxId getAuxId(); @Override OFFactory getOFFactory(); IOFConnectionListener getListener(); @Override void setListener(IOFConnectionListener listener); void messageReceived(OFMessage m); @Override U64 getLatency(); @Override void updateLatency(U64 latency); }
OFConnection implements IOFConnection, IOFConnectionBackend { @Override public Collection<OFMessage> write(final Iterable<OFMessage> msgList) { if (!isConnected()) { if (logger.isDebugEnabled()) logger.debug(this.toString() + " : not connected - dropping {} element msglist {} ", Iterables.size(msgList), String.valueOf(msgList).substring(0, 80)); return IterableUtils.toCollection(msgList); } for (OFMessage m : msgList) { if (logger.isTraceEnabled()) { logger.trace("{}: send {}", this, m); counters.updateWriteStats(m); } } this.channel.eventLoop().execute(new WriteMessageTask(msgList)); return Collections.emptyList(); } OFConnection(@Nonnull DatapathId dpid,
			@Nonnull OFFactory factory,
			@Nonnull Channel channel,
			@Nonnull OFAuxId auxId,
			@Nonnull IDebugCounterService debugCounters,
			@Nonnull Timer timer); @Override Collection<OFMessage> write(final Iterable<OFMessage> msgList); @Override boolean write(OFMessage m); @Override ListenableFuture<R> writeRequest(OFRequest<R> request); @Override ListenableFuture<List<REPLY>> writeStatsRequest(
			OFStatsRequest<REPLY> request); void disconnected(); @Override void disconnect(); @Override String toString(); @Override Date getConnectedSince(); boolean handleGenericDeliverable(OFMessage reply); @Override void cancelAllPendingRequests(); @Override boolean isConnected(); @Override SocketAddress getRemoteInetAddress(); @Override SocketAddress getLocalInetAddress(); boolean deliverResponse(OFMessage m); @Override boolean isWritable(); @Override DatapathId getDatapathId(); @Override OFAuxId getAuxId(); @Override OFFactory getOFFactory(); IOFConnectionListener getListener(); @Override void setListener(IOFConnectionListener listener); void messageReceived(OFMessage m); @Override U64 getLatency(); @Override void updateLatency(U64 latency);  }