discr = readDiscr(line);
if (discr == SimUtils.STAR) {
state = State.READ_NARGS;
} else {
String msg = String.format("wrong byte %s('%c')", discr, discr);
throw new ProtocolException(msg);
}
}
break;
case READ_NARGS:
if (line != null && line.length() != 0) {
nargs = readSize(line);
if (nargs < 1) {
throw new ProtocolException();
}
state = State.READ_ARGUMENT;
requests.request(nargs);
line = null;
}
break;
case READ_ARGUMENT:
if (nargs > 0) {
line = lineReader.readLine(buffer);
if (line != null && line.length() != 0) {
discr = readDiscr(line);
if (discr == SimUtils.DOLLAR) {
state = State.READ_NBYTES;
}
}
} else if (nargs == 0) {
state = State.READ_END;
} else {
throw new ProtocolException();
}
break;
case READ_NBYTES:
if (line != null && line.length() != 0) {
nbytes = readSize(line);