/** * 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 InputStream. Can be called only after saslConnect() has * been called. * * @param in * the InputStream to wrap * @return a SASL wrapped InputStream * @throws IOException */ public InputStream getInputStream(InputStream in) throws IOException { if (!saslClient.isComplete()) { throw new IOException("Sasl authentication exchange hasn't completed yet"); } return new SaslInputStream(in, saslClient); }