Created
September 3, 2011 10:06
-
-
Save oshothebig/1190949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class OpenFlowEncoder extends OneToOneEncoder { | |
@Override | |
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { | |
if (msg instanceof OFMessage) { | |
OFMessage response = (OFMessage) msg; | |
// may have an bad effect on performance | |
ByteBuffer buffer = ByteBuffer.allocate(response.getLength()); | |
response.writeTo(buffer); | |
buffer.flip(); | |
return ChannelBuffers.wrappedBuffer(buffer); | |
} | |
return ChannelBuffers.EMPTY_BUFFER; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment