Package org.spout.api.protocol

Examples of org.spout.api.protocol.MessageCodec


  @Test
  @SuppressWarnings ({"unchecked", "rawtypes"})
  public void testMessageEncoding() throws IOException {
    for (Message message : testMessages) {
      MessageCodec codec = codecLookup.find(message.getClass());
      ByteBuf encoded;
      Message decoded;
      try {
        encoded = codec.encodeToServer(message);
        decoded = codec.decodeFromClient(encoded);
      } catch (Throwable t) {
        t.printStackTrace();
        fail("Failed (C -> S) for: " + message.getClass().getName() + ", " + message);
        return;
      }
      assertEquals("Failed (C -> S) for: " + message.getClass().getName(), message, decoded);
      try {
        encoded = codec.encodeToClient(message);
        decoded = codec.decodeFromServer(encoded);
      } catch (Throwable t) {
        t.printStackTrace();
        fail("Failed (S -> C) for: " + message.getClass().getName() + ", " + message);
        return;
      }
View Full Code Here

TOP

Related Classes of org.spout.api.protocol.MessageCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.