Automatically detect the message types in  MessageToMessageCodec