本文整理汇总了Java中org.jivesoftware.smackx.bytestreams.socks5.Socks5PacketUtils.createBytestreamInitiation方法的典型用法代码示例。如果您正苦于以下问题:Java Socks5PacketUtils.createBytestreamInitiation方法的具体用法?Java Socks5PacketUtils.createBytestreamInitiation怎么用?Java Socks5PacketUtils.createBytestreamInitiation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.bytestreams.socks5.Socks5PacketUtils
的用法示例。
在下文中一共展示了Socks5PacketUtils.createBytestreamInitiation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRespondWithErrorOnSocks5BytestreamRequest
import org.jivesoftware.smackx.bytestreams.socks5.Socks5PacketUtils; //导入方法依赖的package包/类
/**
* Target should respond with not-acceptable error if no listeners for incoming Socks5
* bytestream requests are registered.
*
* @throws XMPPException should not happen
*/
public void testRespondWithErrorOnSocks5BytestreamRequest() throws XMPPException {
XMPPConnection targetConnection = getConnection(0);
XMPPConnection initiatorConnection = getConnection(1);
Bytestream bytestreamInitiation = Socks5PacketUtils.createBytestreamInitiation(
initiatorConnection.getUser(), targetConnection.getUser(), "session_id");
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
bytestreamInitiation.getStanzaId()));
initiatorConnection.sendStanza(bytestreamInitiation);
Packet result = collector.nextResult();
assertNotNull(result.getError());
assertEquals(XMPPError.Condition.no_acceptable.toString(), result.getError().getCondition());
}
示例2: testRespondWithErrorOnSocks5BytestreamRequest
import org.jivesoftware.smackx.bytestreams.socks5.Socks5PacketUtils; //导入方法依赖的package包/类
/**
* Target should respond with not-acceptable error if no listeners for incoming Socks5
* bytestream requests are registered.
*
* @throws XMPPException should not happen
*/
public void testRespondWithErrorOnSocks5BytestreamRequest() throws XMPPException {
Connection targetConnection = getConnection(0);
Connection initiatorConnection = getConnection(1);
Bytestream bytestreamInitiation = Socks5PacketUtils.createBytestreamInitiation(
initiatorConnection.getUser(), targetConnection.getUser(), "session_id");
bytestreamInitiation.addStreamHost("proxy.localhost", "127.0.0.1", 7777);
PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
bytestreamInitiation.getPacketID()));
initiatorConnection.sendPacket(bytestreamInitiation);
Packet result = collector.nextResult();
assertNotNull(result.getError());
assertEquals(XMPPError.Condition.no_acceptable.toString(), result.getError().getCondition());
}