frameDecoder,
messageBufferProtocol.getMessageBufferEventDecoder());
EncoderEmbedder<ChannelBuffer> encoder = new EncoderEmbedder<ChannelBuffer>(
messageBufferProtocol.getLengthFieldPrepender(),
messageBufferProtocol.getMessageBufferEventEncoder());
NettyMessageBuffer payload = new NettyMessageBuffer();
payload.writeStrings("user","pass","TestRoom1");
Event event = Events.event(payload, Events.LOG_IN);
encoder.offer(event);
ChannelBuffer encoded = encoder.peek();
Thread.sleep(100);// so that timestamps will differ.
decoder.offer(encoded);
Event decoded = decoder.peek();
assertEquals(decoded.getType(),Events.LOG_IN);
assertFalse("Timestamps should not be same",decoded.getTimeStamp() == event.getTimeStamp());
NettyMessageBuffer decodedPayload = (NettyMessageBuffer)decoded.getSource();
assertEquals("user",decodedPayload.readString());
assertEquals("pass",decodedPayload.readString());
assertEquals("TestRoom1",decodedPayload.readString());
}