log.debug("DesktopRequestEncoder "+message.getClass().getName());
if (message instanceof ClientFrameBean) {
ClientFrameBean clientFrameBean = (ClientFrameBean) message;
Integer lengthPayload = clientFrameBean.getImageBytes().length;
byte[] securityTokenAsByte = clientFrameBean.getPublicSID().getBytes();
Integer lengthSecurityToken = securityTokenAsByte.length;
Integer frameSize = 4 * 8 + lengthSecurityToken + lengthPayload;
// log.debug("mode "+request.getMode());
// log.debug("sequenceNumber "+request.getSequenceNumber());
// log.debug("lengthSecurityToken "+lengthSecurityToken);
// log.debug("xValue "+xValue);
// log.debug("yValue "+yValue);
// log.debug("width "+width);
// log.debug("height "+height);
// log.debug("lengthPayload "+lengthPayload);
// log.debug("publicSID "+request.getPublicSID());
IoBuffer buffer = IoBuffer.allocate(frameSize, false);
//mode is weather 1(sharing) or 2(recording) or 3(sharing + recording)
buffer.put(this.convertIntToByteArray(clientFrameBean.getMode()));// 4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getSequenceNumber()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthSecurityToken));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getXValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getYValue()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getWidth()));//4 Byte
buffer.put(this.convertIntToByteArray(clientFrameBean.getHeight()));//4 Byte
buffer.put(this.convertIntToByteArray(lengthPayload));//4 Byte
buffer.put(securityTokenAsByte);//32 Byte usually
buffer.put(clientFrameBean.getImageBytes());
log.debug("FRAME SIZE "+ClientCaptureScreen.frameCalculated+"||"+frameSize+"||"+buffer.array().length);
// IoBuffer buffer = IoBuffer.allocate(12, false);
//