本文整理汇总了Java中org.jivesoftware.smackx.bytestreams.BytestreamRequest类的典型用法代码示例。如果您正苦于以下问题:Java BytestreamRequest类的具体用法?Java BytestreamRequest怎么用?Java BytestreamRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BytestreamRequest类属于org.jivesoftware.smackx.bytestreams包,在下文中一共展示了BytestreamRequest类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldInvokeListenerForAllRequests
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a listener for all requests is registered it should be notified on incoming requests.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeListenerForAllRequests() throws Exception {
// add listener
InBandBytestreamListener listener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert that listener is called for the correct request
assertEquals(initiatorJID, byteStreamRequest.getValue().getFrom());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:27,代码来源:InitiationListenerTest.java
示例2: shouldInvokeListenerForUser
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a listener for a specific user in registered it should be notified on incoming requests
* for that user.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeListenerForUser() throws Exception {
// add listener
InBandBytestreamListener listener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener, initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert that reply is the correct error packet
assertEquals(initiatorJID, byteStreamRequest.getValue().getFrom());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:InitiationListenerTest.java
示例3: shouldInvokeListenerForAllRequests
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a listener for all requests is registered it should be notified on incoming requests.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeListenerForAllRequests() throws Exception {
// add listener
Socks5BytestreamListener listener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert that listener is called for the correct request
assertEquals(initiatorJID, byteStreamRequest.getValue().getFrom());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:27,代码来源:InitiationListenerTest.java
示例4: shouldInvokeListenerForUser
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a listener for a specific user in registered it should be notified on incoming requests
* for that user.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeListenerForUser() throws Exception {
// add listener
Socks5BytestreamListener listener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener, initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert that reply is the correct error packet
assertEquals(initiatorJID, byteStreamRequest.getValue().getFrom());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:InitiationListenerTest.java
示例5: shouldNotInvokeListenerForUser
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If listener for a specific user is registered it should not be notified on incoming requests
* from other users.
*
* @throws Exception should not happen
*/
@Test
public void shouldNotInvokeListenerForUser() throws Exception {
// add listener for request of user "other_initiator"
InBandBytestreamListener listener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener, "other_" + initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// capture reply to the In-Band Bytestream open request
ArgumentCaptor<IQ> argument = ArgumentCaptor.forClass(IQ.class);
verify(connection).sendStanza(argument.capture());
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.not_acceptable,
argument.getValue().getError().getCondition());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:34,代码来源:InitiationListenerTest.java
示例6: shouldNotInvokeAllRequestsListenerIfUserListenerExists
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a user specific listener and an all requests listener is registered only the user specific
* listener should be notified.
*
* @throws Exception should not happen
*/
@Test
public void shouldNotInvokeAllRequestsListenerIfUserListenerExists() throws Exception {
// add listener for all request
InBandBytestreamListener allRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "initiator"
InBandBytestreamListener userRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:33,代码来源:InitiationListenerTest.java
示例7: shouldInvokeAllRequestsListenerIfUserListenerExists
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a user specific listener and an all requests listener is registered only the all requests
* listener should be notified on an incoming request for another user.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeAllRequestsListenerIfUserListenerExists() throws Exception {
// add listener for all request
InBandBytestreamListener allRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "other_initiator"
InBandBytestreamListener userRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, "other_"
+ initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:34,代码来源:InitiationListenerTest.java
示例8: shouldNotInvokeListenerForUser
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If listener for a specific user is registered it should not be notified on incoming requests
* from other users.
*
* @throws Exception should not happen
*/
@Test
public void shouldNotInvokeListenerForUser() throws Exception {
// add listener for request of user "other_initiator"
Socks5BytestreamListener listener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(listener, "other_" + initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(listener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// capture reply to the SOCKS5 Bytestream initiation
ArgumentCaptor<IQ> argument = ArgumentCaptor.forClass(IQ.class);
verify(connection).sendStanza(argument.capture());
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.not_acceptable,
argument.getValue().getError().getCondition());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:34,代码来源:InitiationListenerTest.java
示例9: shouldNotInvokeAllRequestsListenerIfUserListenerExists
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a user specific listener and an all requests listener is registered only the user specific
* listener should be notified.
*
* @throws Exception should not happen
*/
@Test
public void shouldNotInvokeAllRequestsListenerIfUserListenerExists() throws Exception {
// add listener for all request
Socks5BytestreamListener allRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "initiator"
Socks5BytestreamListener userRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is called once
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:33,代码来源:InitiationListenerTest.java
示例10: shouldInvokeAllRequestsListenerIfUserListenerExists
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a user specific listener and an all requests listener is registered only the all requests
* listener should be notified on an incoming request for another user.
*
* @throws Exception should not happen
*/
@Test
public void shouldInvokeAllRequestsListenerIfUserListenerExists() throws Exception {
// add listener for all request
Socks5BytestreamListener allRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "other_initiator"
Socks5BytestreamListener userRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, "other_"
+ initiatorJID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:34,代码来源:InitiationListenerTest.java
示例11: incomingBytestreamRequest
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
public void incomingBytestreamRequest(BytestreamRequest request) {
incomingBytestreamRequest((InBandBytestreamRequest) request);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:4,代码来源:InBandBytestreamListener.java
示例12: incomingBytestreamRequest
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
public void incomingBytestreamRequest(BytestreamRequest request) {
incomingBytestreamRequest((Socks5BytestreamRequest) request);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:4,代码来源:Socks5BytestreamListener.java
示例13: shouldIgnoreInBandBytestreamRequestOnce
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a request with a specific session ID should be ignored no listeners should be notified.
*
* @throws Exception should not happen
*/
@Test
public void shouldIgnoreInBandBytestreamRequestOnce() throws Exception {
// add listener for all request
InBandBytestreamListener allRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "initiator"
InBandBytestreamListener userRequestsListener = mock(InBandBytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
// ignore session ID
byteStreamManager.ignoreBytestreamRequestOnce(sessionID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// run the listener with the initiation packet again
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is called on the second request with the
// same session ID
verify(userRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:49,代码来源:InitiationListenerTest.java
示例14: shouldIgnoreSocks5BytestreamRequestOnce
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
/**
* If a request with a specific session ID should be ignored no listeners should be notified.
*
* @throws Exception should not happen
*/
@Test
public void shouldIgnoreSocks5BytestreamRequestOnce() throws Exception {
// add listener for all request
Socks5BytestreamListener allRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(allRequestsListener);
// add listener for request of user "initiator"
Socks5BytestreamListener userRequestsListener = mock(Socks5BytestreamListener.class);
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
// ignore session ID
byteStreamManager.ignoreBytestreamRequestOnce(sessionID);
// run the listener with the initiation packet
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is not called
ArgumentCaptor<BytestreamRequest> byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(userRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
// run the listener with the initiation packet again
initiationListener.handleIQRequest(initBytestream);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// assert user request listener is called on the second request with the same session ID
verify(userRequestsListener).incomingBytestreamRequest(byteStreamRequest.capture());
// assert all requests listener is not called
byteStreamRequest = ArgumentCaptor.forClass(BytestreamRequest.class);
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:48,代码来源:InitiationListenerTest.java
示例15: incomingBytestreamRequest
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
public void incomingBytestreamRequest(BytestreamRequest request) {
incomingBytestreamRequest((InBandBytestreamRequest) request);
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:4,代码来源:InBandBytestreamListener.java
示例16: incomingBytestreamRequest
import org.jivesoftware.smackx.bytestreams.BytestreamRequest; //导入依赖的package包/类
public void incomingBytestreamRequest(BytestreamRequest request) {
incomingBytestreamRequest((Socks5BytestreamRequest) request);
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:4,代码来源:Socks5BytestreamListener.java
注:本文中的org.jivesoftware.smackx.bytestreams.BytestreamRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论