public static Request parse(final byte[] bytes) throws ClassNotFoundException, UnsupportedVersionException {
ByteBuffer buff = ByteBuffer.wrap(bytes);
final byte ver = buff.get();
final Version version = Version.get(ver);
if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
throw new UnsupportedVersionException("This version is no longer supported: " + version.toString(), UnsupportedVersionException.IncompatibleVersion);
}
final byte reserved = buff.get(); // tossed away for now.
final short flags = buff.getShort();
final boolean isRequest = (flags & FLAG_REQUEST) > 0;