HORNETQ-1406 - Correctly handle direct buffers when detect protocol to use

Motivation:

The current code did not work with direct buffers as this expected to be able to access the backing array.

Modifications:

Read directly into a byte array and so make it work with all flavors of ByteBuf.

Result:

No more UnsupportedOperationException when direct buffers are used.
Merge pull request #1835 from clebertsuconic/2.4.x

back port HORNETQ-1406 from master