//extract the data message
byte[] dataMessage = new byte[serverBytes.length-8];
System.arraycopy(serverBytes,8,dataMessage,0,dataMessage.length);
//Verify that the received message is a data message
if ((dataMessage[0]&0x80)!=0x80) {
throw new ProtocolException("Message received: "
+ Util.convert(dataMessage) + " is not a data message");
}
//Verify the length of the message
int size = (dataMessage[2]<<8) + dataMessage[3];
if (size!=dataMessage.length-4) {
throw new ProtocolException("Data message received reported"
+ " incorrect size");
}
}