case WAIT_FOR_THIRD_BYTE_LENGTH:
length += (buffer.readByte() & 255) << 8;
state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
break;
case WAIT_FOR_FOURTH_BYTE_LENGTH:
length += (buffer.readByte() & 255);
state = State.READING;
if ((length == 0) && (buffer.readableBytes() == 0)) {
ctx.getChannel().write(ACK.slice());
state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
}