use of org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession in project Smack by igniterealtime.
the class Socks5TransferNegotiator method negotiateIncomingStream.
@Override
InputStream negotiateIncomingStream(Stanza streamInitiation) throws InterruptedException, SmackException, XMPPErrorException {
// build SOCKS5 Bytestream request
Socks5BytestreamRequest request = new ByteStreamRequest(this.manager, (Bytestream) streamInitiation);
// always accept the request
Socks5BytestreamSession session = request.accept();
// test input stream
try {
PushbackInputStream stream = new PushbackInputStream(session.getInputStream());
int firstByte = stream.read();
stream.unread(firstByte);
return stream;
} catch (IOException e) {
throw new SmackException.SmackWrappedException("Error establishing input stream", e);
}
}
Aggregations