当前位置: 首页>>代码示例>>Java>>正文


Java Socks5PacketUtils.createBytestreamInitiation方法代码示例

本文整理汇总了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());

}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:25,代码来源:Socks5ByteStreamTest.java

示例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());

}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:25,代码来源:Socks5ByteStreamTest.java


注:本文中的org.jivesoftware.smackx.bytestreams.socks5.Socks5PacketUtils.createBytestreamInitiation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。