* This test the structure from end to end. Client -> serialize -> net -> deserialize -> Server
* @throws InvalidVersionException
*/
@Test
public void sendMessageS2C() throws IOException, InvalidVersionException {
TCPNetworkClientManager clientNet=new TCPNetworkClientManager("localhost", PORT);
RPAction action=new RPAction();
action.put("test","hello world");
MessageC2SAction msg=new MessageC2SAction(null, action);
clientNet.addMessage(msg);
MessageC2SAction recv=(MessageC2SAction)netMan.getMessage();
assertEquals(msg.getRPAction(), recv.getRPAction());
RPAction reply=new RPAction();
reply.put("test","world ok");
netMan.sendMessage(new MessageC2SAction(recv.getSocketChannel(), reply));
MessageC2SAction msgReply=null;
while(msgReply==null) {
msgReply=(MessageC2SAction) clientNet.getMessage(100);
}
assertNotNull(msgReply);
assertEquals(reply, msgReply.getRPAction());
}