@Override public void consume(Message message) { try { String content = jsonHandler.serialize(message); byte[] contentBytes = content.getBytes(encoding); int contentLength = contentBytes.length; String header = getHeader(contentLength); byte[] headerBytes = header.getBytes(StandardCharsets.US_ASCII); synchronized (outputLock) { output.write(headerBytes); output.write(contentBytes); output.flush(); } } catch (IOException exception) { throw new JsonRpcException(exception); } }
@Override public void consume(Message message) { try { String content = jsonHandler.serialize(message); byte[] contentBytes = content.getBytes(encoding); int contentLength = contentBytes.length; String header = getHeader(contentLength); byte[] headerBytes = header.getBytes(StandardCharsets.US_ASCII); synchronized (outputLock) { output.write(headerBytes); output.write(contentBytes); output.flush(); } } catch (IOException exception) { throw new JsonRpcException(exception); } }
@Override public void consume(Message message) throws JsonRpcException { throw new JsonRpcException(new SocketException("Socket closed")); } };
@Override public void consume(Message message) throws JsonRpcException { throw new JsonRpcException(new SocketException("Permission denied: connect")); } };
fireStreamClosed(exception); else throw new JsonRpcException(exception); } finally { this.callback = null;
fireStreamClosed(exception); else throw new JsonRpcException(exception); } finally { this.callback = null;