• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DummySession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.mina.core.session.DummySession的典型用法代码示例。如果您正苦于以下问题:Java DummySession类的具体用法?Java DummySession怎么用?Java DummySession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DummySession类属于org.apache.mina.core.session包,在下文中一共展示了DummySession类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testFrames

import org.apache.mina.core.session.DummySession; //导入依赖的package包/类
protected void testFrames ( final String resourceName, final Frame... expectedFrames ) throws Exception
{
    final FrameDecoder decoder = new FrameDecoder ();
    final MockProtocolDecoderOutput out = new MockProtocolDecoderOutput ();
    final DummySession session = new DummySession ();

    session.setTransportMetadata ( new DefaultTransportMetadata ( "eclipse.scada", "test", false, true, SocketAddress.class, IoSessionConfig.class, Object.class ) );

    for ( final IoBuffer data : BufferLoader.loadBuffersFromResource ( FrameDecoderTest.class, resourceName ) )
    {
        System.out.println ( "Pushing data packet - " + data.getHexDump () );
        decoder.decode ( session, data, out );
    }

    out.assertMessages ( expectedFrames );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:FrameDecoderTest.java


示例2: retrySync

import org.apache.mina.core.session.DummySession; //导入依赖的package包/类
private <R extends Response> R retrySync(Request aRequest) throws Exception {
    RequestEnvelope requestEnv = new RequestEnvelope(aRequest, null, null, sessionTicket, null);
    Logger.getLogger(PlatypusPlatypusConnection.class.getName()).log(Level.FINE, "{0} is connecting to {1}:{2}.", new Object[]{Thread.currentThread().getName(), host, port});
    if (!syncSocket.isConnected()) {
        syncSocket.connect(new InetSocketAddress(host, port));
    }
    Logger.getLogger(PlatypusPlatypusConnection.class.getName()).log(Level.FINE, "{0} is connected to {1}:{2}.", new Object[]{Thread.currentThread().getName(), host, port});
    SyncProtocolEncoderOutput requestOut = new SyncProtocolEncoderOutput();
    syncEncoder.encode(null, requestEnv, requestOut);
    Object oFiltered = requestOut.getFiltered();
    OutputStream os = syncSocket.getOutputStream();
    IoBuffer toWrite = (IoBuffer) oFiltered;
    os.write(toWrite.array());
    byte[] readBuffer = new byte[1024 * 16];
    ByteArrayOutputStream accumulated = new ByteArrayOutputStream();
    InputStream is = syncSocket.getInputStream();
    int read = 0;
    while (read > -1) {
        read = is.read(readBuffer);
        accumulated.write(readBuffer, 0, read);
        SyncProtocolDecoderOutput responseOut = new SyncProtocolDecoderOutput();
        IoSession session = new DummySession();
        session.setAttribute(RequestEnvelope.class.getSimpleName(), requestEnv);
        if (syncDecoder.doDecode(session, IoBuffer.wrap(accumulated.toByteArray()), responseOut)) {
            sessionTicket = requestEnv.ticket;
            return (R) responseOut.getFiltered();
        }
    }
    throw new Exception("No response was recieved via platypus protocol");
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:31,代码来源:PlatypusPlatypusConnection.java


示例3: setUp

import org.apache.mina.core.session.DummySession; //导入依赖的package包/类
@Before
public void setUp() throws InterruptedException {
    connMsg = new ConnectMessage();
    connMsg.setProcotolVersion((byte) 0x03);

    m_minaSession = new DummySession();
    
    m_session = new MinaChannel(m_minaSession);

    m_minaSession.getFilterChain().addFirst("MessageCatcher", new IoFilterAdapter() {

        @Override
        public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session,
                                WriteRequest writeRequest) throws Exception {
            try {
                m_receivedMessage = (AbstractMessage) writeRequest.getMessage();
                if (m_receivedMessage instanceof ConnAckMessage) {
                    ConnAckMessage buf = (ConnAckMessage) m_receivedMessage;
                    m_returnCode = buf.getReturnCode();
                }
            } catch (Exception ex) {
                throw new AssertionError("Wrong return code");
            }
        }
    });

    //sleep to let the messaging batch processor to process the initEvent
    Thread.sleep(300);
    
    m_storageService = new MemoryStorageService();
    //m_storageService.initStore();

    subscriptions = new SubscriptionsStore();
    subscriptions.init(m_storageService);
    m_processor = new ProtocolProcessor();
    m_processor.init(subscriptions, m_storageService);
}
 
开发者ID:milliondreams,项目名称:moquette-mqtt,代码行数:38,代码来源:ProtocolProcessorTest.java


示例4: RTMPTConnection

import org.apache.mina.core.session.DummySession; //导入依赖的package包/类
/** Constructs a new RTMPTConnection */
RTMPTConnection() {
    super(IConnection.Type.POLLING.name().toLowerCase());
    // create a DummySession for the HTTP-based connection to allow our Mina based system happy
    ioSession = new DummySession();
    ioSession.setAttribute(RTMPConnection.RTMP_SESSION_ID, sessionId);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:8,代码来源:RTMPTConnection.java


示例5: getSession

import org.apache.mina.core.session.DummySession; //导入依赖的package包/类
/**
 * Creates a DummySession for this HTTP-based connection to allow our Mina based system happy.
 * 
 * @return session
 */
protected IoSession getSession() {
	IoSession session = new DummySession();
	session.setAttribute(RTMPConnection.RTMP_CONNECTION_KEY, this);
	session.setAttribute(ProtocolState.SESSION_KEY, getState());
	return session;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:12,代码来源:RTMPTConnection.java



注:本文中的org.apache.mina.core.session.DummySession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IConsoleLineTracker类代码示例发布时间:2022-05-23
下一篇:
Java UnmodifiableList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap