change parser and encoder to generic ones
make the method to specify which type of message to parse/encode