inFragmentedType = opcode;
}
}
}
TyrusFrame tyrusFrame = TyrusFrame.wrap(frame, inFragmentedType, remainder);
// TODO - utf8 decoder needs this state to be shared among decoded frames.
// TODO - investigate whether it can be removed; (this effectively denies lazy decoding)
if (tyrusFrame instanceof TextFrame) {
remainder = ((TextFrame) tyrusFrame).getRemainder();
}
// server should not allow receiving 1012 or 1013 from the client
// (SERVICE_RESTART and TRY_AGAIN_LATER does not make sense from the client side.
if (!client) {
if (tyrusFrame.isControlFrame() && tyrusFrame instanceof CloseFrame) {
CloseReason.CloseCode closeCode = ((CloseFrame) tyrusFrame).getCloseReason().getCloseCode();
if (closeCode.equals(CloseReason.CloseCodes.SERVICE_RESTART) || closeCode.equals(CloseReason.CloseCodes.TRY_AGAIN_LATER)) {
throw new ProtocolException("Illegal close code: " + closeCode);
}
}
}
tyrusFrame.respond(socket);
if (!tyrusFrame.isControlFrame() && fin) {
inFragmentedType = 0;
processingFragment = false;
}
}