private void initStreams() throws IOException { traceInput = new TraceInputStream(socket.getInputStream(), traceLogger); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(socket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); }
/** * Resume protocol tracing, if it was enabled to begin with. */ protected void resumeTracing() { if (traceLogger.isLoggable(Level.FINEST)) { traceInput.setTrace(true); traceOutput.setTrace(true); } }
/** * Reads the next byte of data from this input stream. Returns * <code>-1</code> if no data is available. Writes out the read * byte into the trace stream, if trace mode is <code>true</code> */ public int read() throws IOException { int b = in.read(); if (trace && b != -1) { if (quote) writeByte(b); else traceOut.write(b); } return b; }
private void initStreams(PrintStream out) throws IOException { traceInput = new TraceInputStream(socket.getInputStream(), out); traceInput.setTrace(debug); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(socket.getOutputStream(), out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); }
private void initStreams(PrintStream out) throws IOException { traceInput = new TraceInputStream(socket.getInputStream(), out); traceInput.setTrace(debug); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(socket.getOutputStream(), out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); }
private void initStreams() throws IOException { traceInput = new TraceInputStream(socket.getInputStream(), traceLogger); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(socket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); }
/** * Constructor for debugging. */ public Protocol(InputStream in, OutputStream out, boolean debug) throws IOException { this.host = "localhost"; this.debug = debug; this.quote = false; this.out = System.out; // XXX - inlined initStreams, won't allow later startTLS traceInput = new TraceInputStream(in, System.out); traceInput.setTrace(debug); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(out, System.out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); timestamp = System.currentTimeMillis(); }
/** * Temporarily turn off protocol tracing, e.g., to prevent * tracing the authentication sequence, including the password. */ protected void suspendTracing() { if (traceLogger.isLoggable(Level.FINEST)) { traceInput.setTrace(false); traceOutput.setTrace(false); } }
/** * Reads the next byte of data from this input stream. Returns * <code>-1</code> if no data is available. Writes out the read * byte into the trace stream, if trace mode is <code>true</code> */ @Override public int read() throws IOException { int b = in.read(); if (trace && b != -1) { if (quote) writeByte(b); else traceOut.write(b); } return b; }
private void initStreams() throws IOException { boolean quote = PropUtil.getBooleanProperty(props, "mail.debug.quote", false); traceInput = new TraceInputStream(socket.getInputStream(), traceLogger); traceInput.setQuote(quote); traceOutput = new TraceOutputStream(socket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); // should be US-ASCII, but not all JDK's support it so use iso-8859-1 input = new BufferedReader(new InputStreamReader(traceInput, "iso-8859-1")); output = new PrintWriter( new BufferedWriter( new OutputStreamWriter(traceOutput, "iso-8859-1"))); }
/** * Constructor for debugging. */ public Protocol(InputStream in, OutputStream out, boolean debug) throws IOException { this.host = "localhost"; this.debug = debug; this.quote = false; this.out = System.out; // XXX - inlined initStreams, won't allow later startTLS traceInput = new TraceInputStream(in, System.out); traceInput.setTrace(debug); traceInput.setQuote(quote); input = new ResponseInputStream(traceInput); traceOutput = new TraceOutputStream(out, System.out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); output = new DataOutputStream(new BufferedOutputStream(traceOutput)); timestamp = System.currentTimeMillis(); }
/** * Temporarily turn off protocol tracing, e.g., to prevent * tracing the authentication sequence, including the password. */ private void suspendTracing() { if (traceLogger.isLoggable(Level.FINEST)) { traceInput.setTrace(false); traceOutput.setTrace(false); } }
/** * Reads up to <code>len</code> bytes of data from this input stream * into an array of bytes. Returns <code>-1</code> if no more data * is available. Writes out the read bytes into the trace stream, if * trace mode is <code>true</code> */ public int read(byte b[], int off, int len) throws IOException { int count = in.read(b, off, len); if (trace && count != -1) { if (quote) { for (int i = 0; i < count; i++) writeByte(b[off + i]); } else traceOut.write(b, off, count); } return count; }
private void initStreams() throws IOException { boolean quote = PropUtil.getBooleanProperty(props, "mail.debug.quote", false); traceInput = new TraceInputStream(socket.getInputStream(), traceLogger); traceInput.setQuote(quote); traceOutput = new TraceOutputStream(socket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); // should be US-ASCII, but not all JDK's support it so use iso-8859-1 input = new BufferedReader(new InputStreamReader(traceInput, "iso-8859-1")); output = new PrintWriter( new BufferedWriter( new OutputStreamWriter(traceOutput, "iso-8859-1"))); }
private void initStreams() throws IOException { PrintStream out = session.getDebugOut(); boolean quote = PropUtil.getBooleanSessionProperty(session, "mail.debug.quote", false); traceInput = new TraceInputStream(serverSocket.getInputStream(), out); traceInput.setTrace(debug); traceInput.setQuote(quote); traceOutput = new TraceOutputStream(serverSocket.getOutputStream(), out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); serverOutput = new BufferedOutputStream(traceOutput); serverInput = new BufferedInputStream(traceInput); lineInputStream = new LineInputStream(serverInput); }
/** * Resume protocol tracing, if it was enabled to begin with. */ private void resumeTracing() { if (traceLogger.isLoggable(Level.FINEST)) { traceInput.setTrace(true); traceOutput.setTrace(true); } }
/** * Reads up to <code>len</code> bytes of data from this input stream * into an array of bytes. Returns <code>-1</code> if no more data * is available. Writes out the read bytes into the trace stream, if * trace mode is <code>true</code> */ @Override public int read(byte b[], int off, int len) throws IOException { int count = in.read(b, off, len); if (trace && count != -1) { if (quote) { for (int i = 0; i < count; i++) writeByte(b[off + i]); } else traceOut.write(b, off, count); } return count; }
private void initStreams() throws IOException { boolean quote = PropUtil.getBooleanSessionProperty(session, "mail.debug.quote", false); traceInput = new TraceInputStream(serverSocket.getInputStream(), traceLogger); traceInput.setQuote(quote); traceOutput = new TraceOutputStream(serverSocket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); serverOutput = new BufferedOutputStream(traceOutput); serverInput = new BufferedInputStream(traceInput); lineInputStream = new LineInputStream(serverInput); }
private void initStreams() throws IOException { Properties props = session.getProperties(); PrintStream out = session.getDebugOut(); boolean debug = session.getDebug(); String s = props.getProperty("mail.debug.quote"); boolean quote = s != null && s.equalsIgnoreCase("true"); TraceInputStream traceInput = new TraceInputStream(serverSocket.getInputStream(), out); traceInput.setTrace(debug); traceInput.setQuote(quote); TraceOutputStream traceOutput = new TraceOutputStream(serverSocket.getOutputStream(), out); traceOutput.setTrace(debug); traceOutput.setQuote(quote); serverOutput = new BufferedOutputStream(traceOutput); serverInput = new BufferedInputStream(traceInput); lineInputStream = new LineInputStream(serverInput); }
/** * Temporarily turn off protocol tracing, e.g., to prevent * tracing the authentication sequence, including the password. */ private void suspendTracing() { if (traceLogger.isLoggable(Level.FINEST)) { traceInput.setTrace(false); traceOutput.setTrace(false); } }