/** * Return some input/output streams that may henceforth have their * communication encrypted, depending on the negotiated quality of protection. * * @param out output stream to wrap * @param in input stream to wrap * @return IOStreamPair wrapping the streams */ public IOStreamPair createStreamPair(DataOutputStream out, DataInputStream in) { if (saslClient != null) { return new IOStreamPair( new SaslInputStream(in, saslClient), new SaslOutputStream(out, saslClient)); } else { return new IOStreamPair( new SaslInputStream(in, saslServer), new SaslOutputStream(out, saslServer)); } }
private IOStreamPair createEncryptedStreamPair( DataOutputStream out, DataInputStream in) { if (saslClient != null) { return new IOStreamPair( new SaslInputStream(in, saslClient), new SaslOutputStream(out, saslClient)); } else { return new IOStreamPair( new SaslInputStream(in, saslServer), new SaslOutputStream(out, saslServer)); } }
private IOStreamPair createEncryptedStreamPair(DataOutputStream out, DataInputStream in) { if (saslClient != null) { return new IOStreamPair(new SaslInputStream(in, saslClient), new SaslOutputStream(out, saslClient)); } else { return new IOStreamPair(new SaslInputStream(in, saslServer), new SaslOutputStream(out, saslServer)); } }
/** * Get a SASL wrapped OutputStream. Can be called only after saslConnect() has * been called. * * @param out * the OutputStream to wrap * @return a SASL wrapped OutputStream * @throws IOException */ public OutputStream getOutputStream(OutputStream out) throws IOException { if (!saslClient.isComplete()) { throw new IOException("Sasl authentication exchange hasn't completed yet"); } return new SaslOutputStream(out, saslClient); }