private final void close(Throwable t) { CloseReason cr; if (t instanceof WsIOException) { cr = ((WsIOException) t).getCloseReason(); } else { cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); } try { wsSession.close(cr); } catch (IOException ignore) { // Ignore } }
@SuppressWarnings("unchecked") protected void sendMessageText(boolean last) throws WsIOException { if (textMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && messageBufferText.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, sm.getString("wsFrame.messageTooBig", Long.valueOf(messageBufferText.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (textMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<String>) textMsgHandler) .onMessage(messageBufferText.toString(), last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<String>) textMsgHandler) .onMessage(messageBufferText.toString()); } } catch (Throwable t) { handleThrowableOnSend(t); } finally { messageBufferText.clear(); } }
@SuppressWarnings("unchecked") protected void sendMessageText(boolean last) throws WsIOException { if (textMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && messageBufferText.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, sm.getString("wsFrame.messageTooBig", Long.valueOf(messageBufferText.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (textMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<String>) textMsgHandler) .onMessage(messageBufferText.toString(), last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<String>) textMsgHandler) .onMessage(messageBufferText.toString()); } } catch (Throwable t) { handleThrowableOnSend(t); } finally { messageBufferText.clear(); } }
private final void close(Throwable t) { CloseReason cr; if (t instanceof WsIOException) { cr = ((WsIOException) t).getCloseReason(); } else { cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); } try { wsSession.close(cr); } catch (IOException ignore) { // Ignore } }
@SuppressWarnings("unchecked") private void sendMessageText(boolean last) throws WsIOException { if (textMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && messageBufferText.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, MESSAGES.messageTooLarge(Long.valueOf(messageBufferText.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (textMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<String>) textMsgHandler).onMessage( messageBufferText.toString(), last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<String>) textMsgHandler).onMessage( messageBufferText.toString()); } } catch (Throwable t) { handleThrowableOnSend(t); } finally { messageBufferText.clear(); } }
private final void close(Throwable t) { CloseReason cr; if (t instanceof WsIOException) { cr = ((WsIOException) t).getCloseReason(); } else { cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); } try { wsSession.close(cr); } catch (IOException ignore) { // Ignore } }
@SuppressWarnings("unchecked") private void sendMessageText(boolean last) throws WsIOException { if (textMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && messageBufferText.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, sm.getString("wsFrame.messageTooBig", Long.valueOf(messageBufferText.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (textMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<String>) textMsgHandler).onMessage( messageBufferText.toString(), last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<String>) textMsgHandler).onMessage( messageBufferText.toString()); } } catch (Throwable t) { handleThrowableOnSend(t); } finally { messageBufferText.clear(); } }
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
messageBufferBinary.capacity()), Long.valueOf(payloadLength))); throw new WsIOException(cr);
private final void close(Throwable t) { changeReadState(ReadState.CLOSING); CloseReason cr; if (t instanceof WsIOException) { cr = ((WsIOException) t).getCloseReason(); } else { cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); } try { wsSession.close(cr); } catch (IOException ignore) { // Ignore } }
@SuppressWarnings("unchecked") protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException { if (binaryMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, sm.getString("wsFrame.messageTooBig", Long.valueOf(msg.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (binaryMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg); } } catch (Throwable t) { handleThrowableOnSend(t); } }
private final void close(Throwable t) { changeReadState(ReadState.CLOSING); CloseReason cr; if (t instanceof WsIOException) { cr = ((WsIOException) t).getCloseReason(); } else { cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); } try { wsSession.close(cr); } catch (IOException ignore) { // Ignore } }
throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.controlPayloadTooBig", Long.valueOf(payloadLength)))); throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.controlNoFin")));
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (EOFException eof) { CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, eof.getMessage()); wsProtocolHandler.close(cr); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.controlPayloadTooBig", Long.valueOf(payloadLength)))); throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.controlNoFin")));
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (EOFException eof) { CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, eof.getMessage()); wsProtocolHandler.close(cr); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
@SuppressWarnings("unchecked") private void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException { if (binaryMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, MESSAGES.messageTooLarge( Long.valueOf(msg.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (binaryMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg); } } catch(Throwable t) { handleThrowableOnSend(t); } }
return wsFrame.notifyDataAvailable(); } catch (WsIOException ws) { close(ws.getCloseReason()); } catch (IOException ioe) { onError(ioe);
@SuppressWarnings("unchecked") protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException { if (binaryMsgHandler instanceof WrappedMessageHandler) { long maxMessageSize = ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize(); if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) { throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG, sm.getString("wsFrame.messageTooBig", Long.valueOf(msg.remaining()), Long.valueOf(maxMessageSize)))); } } try { if (binaryMsgHandler instanceof MessageHandler.Partial<?>) { ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last); } else { // Caller ensures last == true if this branch is used ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg); } } catch (Throwable t) { handleThrowableOnSend(t); } }
return wsFrame.notifyDataAvailable(); } catch (WsIOException ws) { close(ws.getCloseReason()); } catch (IOException ioe) { onError(ioe);