public void sendFiles(List<String> pathnames) throws IOException { for (String pathname : pathnames) { mllp.writeMessage(readFile(pathname)); if (mllp.readMessage() == null) throw new IOException("Connection closed by receiver"); } }
@Override public void close() throws IOException { mllpConnection.close(); } }
public void writeMessage(UnparsedHL7Message msg) throws IOException { try { mllpConnection.writeMessage(msg.data()); if (monitor != null) monitor.onMessageSent(hl7Application, mllpConnection.getSocket(), msg, null); } catch (IOException e) { monitor.onMessageSent(hl7Application, mllpConnection.getSocket(), msg, e); throw e; } }
public UnparsedHL7Message readMessage(UnparsedHL7Message msg) throws IOException { try { byte[] b = mllpConnection.readMessage(); UnparsedHL7Message rsp = b != null ? new UnparsedHL7Message(b) : null; monitor.onMessageResponse(hl7Application, mllpConnection.getSocket(), msg, rsp, null); return rsp; } catch (IOException e) { monitor.onMessageResponse(hl7Application, mllpConnection.getSocket(), msg, null, e); throw e; } }
public void run() { try { s.setSoTimeout(conn.getIdleTimeout()); MLLPConnection mllp = new MLLPConnection(s); byte[] data; while ((data = mllp.readMessage()) != null) { HL7ConnectionMonitor monitor = hl7dev.getHL7ConnectionMonitor(); UnparsedHL7Message msg = new UnparsedHL7Message(data); if (monitor != null) monitor.onMessageReceived(conn, s, msg); UnparsedHL7Message rsp; try { rsp = hl7dev.onMessage(conn, s, msg); if (monitor != null) monitor.onMessageProcessed(conn, s, msg, rsp, null); } catch (HL7Exception e) { rsp = new UnparsedHL7Message( HL7Message.makeACK(msg.msh(), e).getBytes(null)); if (monitor != null) monitor.onMessageProcessed(conn, s, msg, rsp, e); } mllp.writeMessage(rsp.data()); } } catch (IOException e) { LOG.warn("Exception on accepted connection {}:", s, e); } finally { conn.close(s); } } }
public void open() throws IOException, IncompatibleConnectionException, GeneralSecurityException { sock = conn.connect(remote); sock.setSoTimeout(conn.getResponseTimeout()); mllp = new MLLPConnection(sock); }
public void writeMessage(byte[] b) throws IOException { writeMessage(b, 0, b.length); }
public byte[] readMessage() throws IOException { byte[] b = mllpIn.readMessage(); if (b != null) log("{} >> {}", b, 0, b.length); return b; }
public void open() throws IOException, IncompatibleConnectionException, GeneralSecurityException { sock = conn.connect(remote); sock.setSoTimeout(conn.getResponseTimeout()); mllp = new MLLPConnection(sock); }
public void writeMessage(byte[] b, int off, int len) throws IOException { log("{} << {}", b, off, len); mllpOut.writeMessage(b, off, len); }
public void sendFiles(List<String> pathnames) throws IOException { for (String pathname : pathnames) { mllp.writeMessage(readFile(pathname)); if (mllp.readMessage() == null) throw new IOException("Connection closed by receiver"); } }
public void open() throws IOException, IncompatibleConnectionException, GeneralSecurityException { sock = conn.connect(remote); sock.setSoTimeout(conn.getResponseTimeout()); mllp = new MLLPConnection(sock); }
public void query(String pid, String[] domains) throws IOException { HL7Message qbp = HL7Message.makePixQuery(pid, domains); HL7Segment msh = qbp.get(0); msh.setSendingApplicationWithFacility(sendingApplication); msh.setReceivingApplicationWithFacility(receivingApplication); msh.setField(17, charset); mllp.writeMessage(qbp.getBytes(charset)); if (mllp.readMessage() == null) throw new IOException("Connection closed by receiver"); } }
public void open() throws IOException, IncompatibleConnectionException, GeneralSecurityException { sock = conn.connect(remote); sock.setSoTimeout(conn.getResponseTimeout()); mllp = new MLLPConnection(sock); }
public void query(String pid, String[] domains) throws IOException { HL7Message qbp = HL7Message.makePixQuery(pid, domains); HL7Segment msh = qbp.get(0); msh.setSendingApplicationWithFacility(sendingApplication); msh.setReceivingApplicationWithFacility(receivingApplication); msh.setField(17, charset); mllp.writeMessage(qbp.getBytes(charset)); if (mllp.readMessage() == null) throw new IOException("Connection closed by receiver"); } }
public MLLPConnection connect(Connection local, Connection remote) throws IOException, IncompatibleConnectionException, GeneralSecurityException { checkDevice(); checkInstalled(); Socket sock = local.connect(remote); sock.setSoTimeout(local.getResponseTimeout()); return new MLLPConnection(sock); }