本文整理汇总了Java中org.jivesoftware.smackx.bytestreams.ibb.packet.Close类的典型用法代码示例。如果您正苦于以下问题:Java Close类的具体用法?Java Close怎么用?Java Close使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Close类属于org.jivesoftware.smackx.bytestreams.ibb.packet包,在下文中一共展示了Close类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: closeByPeer
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if a request to close the In-Band Bytestream has been received.
*
* @param closeRequest the close request from the remote peer
* @throws NotConnectedException
*/
protected void closeByPeer(Close closeRequest) throws NotConnectedException {
/*
* close streams without flushing them, because stream is already considered closed on the
* remote peers side
*/
this.inputStream.closeInternal();
this.inputStream.cleanup();
this.outputStream.closeInternal(false);
// acknowledge close request
IQ confirmClose = IQ.createResultIQ(closeRequest);
this.connection.sendStanza(confirmClose);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:22,代码来源:InBandBytestreamSession.java
示例2: closeByPeer
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if a request to close the In-Band Bytestream has been received.
*
* @param closeRequest the close request from the remote peer
*/
protected void closeByPeer(Close closeRequest) {
/*
* close streams without flushing them, because stream is already considered closed on the
* remote peers side
*/
this.inputStream.closeInternal();
this.inputStream.cleanup();
this.outputStream.closeInternal(false);
// acknowledge close request
IQ confirmClose = IQ.createResultIQ(closeRequest);
this.connection.sendPacket(confirmClose);
}
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:InBandBytestreamSession.java
示例3: closeByPeer
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if a request to close the In-Band Bytestream has
* been received.
*
* @param closeRequest
* the close request from the remote peer
*/
protected void closeByPeer(Close closeRequest) {
/*
* close streams without flushing them, because stream is already
* considered closed on the remote peers side
*/
this.inputStream.closeInternal();
this.inputStream.cleanup();
this.outputStream.closeInternal(false);
// acknowledge close request
IQ confirmClose = IQ.createResultIQ(closeRequest);
this.connection.sendPacket(confirmClose);
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:23,代码来源:InBandBytestreamSession.java
示例4: shouldReplyErrorIfSessionIsUnknown
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* If a close request to an unknown session is received it should be replied
* with an <item-not-found/> error.
*
* @throws Exception should not happen
*/
@Test
public void shouldReplyErrorIfSessionIsUnknown() throws Exception {
// mock connection
XMPPConnection connection = mock(XMPPConnection.class);
// initialize InBandBytestreamManager to get the CloseListener
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
// get the CloseListener from InBandByteStreamManager
CloseListener closeListener = Whitebox.getInternalState(byteStreamManager,
CloseListener.class);
Close close = new Close("unknownSessionId");
close.setFrom(initiatorJID);
close.setTo(targetJID);
closeListener.handleIQRequest(close);
// wait because packet is processed in an extra thread
Thread.sleep(200);
// capture reply to the In-Band Bytestream close 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.item_not_found,
argument.getValue().getError().getCondition());
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:40,代码来源:CloseListenerTest.java
示例5: processPacket
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
public void processPacket(Packet packet) {
Close closeRequest = (Close) packet;
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
closeRequest.getSessionID());
if (ibbSession == null) {
this.manager.replyItemNotFoundPacket(closeRequest);
}
else {
ibbSession.closeByPeer(closeRequest);
this.manager.getSessions().remove(closeRequest.getSessionID());
}
}
开发者ID:ice-coffee,项目名称:EIM,代码行数:14,代码来源:CloseListener.java
示例6: closeByLocal
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if one of the streams has been closed locally, if an error occurred
* locally or if the whole session should be closed.
*
* @throws IOException if an error occurs while sending the close request
*/
protected synchronized void closeByLocal(boolean in) throws IOException {
if (this.isClosed) {
return;
}
if (this.closeBothStreamsEnabled) {
this.inputStream.closeInternal();
this.outputStream.closeInternal(true);
}
else {
if (in) {
this.inputStream.closeInternal();
}
else {
// close stream but try to send any data left
this.outputStream.closeInternal(true);
}
}
if (this.inputStream.isClosed && this.outputStream.isClosed) {
this.isClosed = true;
// send close request
Close close = new Close(this.byteStreamRequest.getSessionID());
close.setTo(this.remoteJID);
try {
SyncPacketSend.getReply(this.connection, close);
}
catch (XMPPException e) {
throw new IOException("Error while closing stream: " + e.getMessage());
}
this.inputStream.cleanup();
// remove session from manager
InBandBytestreamManager.getByteStreamManager(this.connection).getSessions().remove(this);
}
}
开发者ID:ice-coffee,项目名称:EIM,代码行数:46,代码来源:InBandBytestreamSession.java
示例7: processPacket
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
public void processPacket(Packet packet) {
Close closeRequest = (Close) packet;
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
closeRequest.getSessionID());
if (ibbSession == null) {
this.manager.replyItemNotFoundPacket(closeRequest);
} else {
ibbSession.closeByPeer(closeRequest);
this.manager.getSessions().remove(closeRequest.getSessionID());
}
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:13,代码来源:CloseListener.java
示例8: closeByLocal
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if one of the streams has been closed locally, if
* an error occurred locally or if the whole session should be closed.
*
* @throws IOException
* if an error occurs while sending the close request
*/
protected synchronized void closeByLocal(boolean in) throws IOException {
if (this.isClosed) {
return;
}
if (this.closeBothStreamsEnabled) {
this.inputStream.closeInternal();
this.outputStream.closeInternal(true);
} else {
if (in) {
this.inputStream.closeInternal();
} else {
// close stream but try to send any data left
this.outputStream.closeInternal(true);
}
}
if (this.inputStream.isClosed && this.outputStream.isClosed) {
this.isClosed = true;
// send close request
Close close = new Close(this.byteStreamRequest.getSessionID());
close.setTo(this.remoteJID);
try {
SyncPacketSend.getReply(this.connection, close);
} catch (XMPPException e) {
throw new IOException("Error while closing stream: "
+ e.getMessage());
}
this.inputStream.cleanup();
// remove session from manager
InBandBytestreamManager.getByteStreamManager(this.connection)
.getSessions().remove(this);
}
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:46,代码来源:InBandBytestreamSession.java
示例9: parse
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
@Override
public Close parse(XmlPullParser parser, int initialDepth) {
String sid = parser.getAttributeValue("", "sid");
return new Close(sid);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:6,代码来源:CloseIQProvider.java
示例10: closeByLocal
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* This method is invoked if one of the streams has been closed locally, if an error occurred
* locally or if the whole session should be closed.
*
* @throws IOException if an error occurs while sending the close request
*/
protected synchronized void closeByLocal(boolean in) throws IOException {
if (this.isClosed) {
return;
}
if (this.closeBothStreamsEnabled) {
this.inputStream.closeInternal();
this.outputStream.closeInternal(true);
}
else {
if (in) {
this.inputStream.closeInternal();
}
else {
// close stream but try to send any data left
this.outputStream.closeInternal(true);
}
}
if (this.inputStream.isClosed && this.outputStream.isClosed) {
this.isClosed = true;
// send close request
Close close = new Close(this.byteStreamRequest.getSessionID());
close.setTo(this.remoteJID);
try {
connection.createPacketCollectorAndSend(close).nextResultOrThrow();
}
catch (Exception e) {
// Sadly we are unable to use the IOException(Throwable) constructor because this
// constructor is only supported from Android API 9 on.
IOException ioException = new IOException();
ioException.initCause(e);
throw ioException;
}
this.inputStream.cleanup();
// remove session from manager
InBandBytestreamManager.getByteStreamManager(this.connection).getSessions().remove(this);
}
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:50,代码来源:InBandBytestreamSession.java
示例11: parseIQ
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception {
String sid = parser.getAttributeValue("", "sid");
return new Close(sid);
}
开发者ID:ice-coffee,项目名称:EIM,代码行数:5,代码来源:CloseIQProvider.java
示例12: parseIQ
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception {
String sid = parser.getAttributeValue("", "sid");
return new Close(sid);
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:5,代码来源:CloseIQProvider.java
示例13: CloseListener
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close; //导入依赖的package包/类
/**
* Constructor.
*
* @param manager the In-Band Bytestream manager
*/
protected CloseListener(InBandBytestreamManager manager) {
super(Close.ELEMENT, Close.NAMESPACE, IQ.Type.set, Mode.async);
this.manager = manager;
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:10,代码来源:CloseListener.java
注:本文中的org.jivesoftware.smackx.bytestreams.ibb.packet.Close类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论