Skip to content

Instantly share code, notes, and snippets.

@oshothebig
Created September 3, 2011 10:05
Show Gist options
  • Save oshothebig/1190948 to your computer and use it in GitHub Desktop.
Save oshothebig/1190948 to your computer and use it in GitHub Desktop.
private static class OpenFlowDecoder extends OneToOneDecoder {
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
if (!(msg instanceof ChannelBuffer)) {
return msg;
}
ChannelBuffer channelBuffer = (ChannelBuffer)msg;
ByteBuffer byteBuffer = channelBuffer.toByteBuffer();
List<OFMessage> messages = factory.parseMessages(byteBuffer);
return messages.get(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment