Java 类org.jivesoftware.smack.packet.PlainStreamElement 实例源码

项目:Smack    文件:SynchronizationPoint.java   
/**
 * Send the given top level stream element and wait for a response.
 *
 * @param request the plain stream element to send.
 * @throws NoResponseException if no response was received.
 * @throws NotConnectedException if the connection is not connected.
 */
public void sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
                NotConnectedException {
    assert (state == State.Initial);
    connectionLock.lock();
    try {
        if (request != null) {
            if (request instanceof Stanza) {
                connection.sendStanza((Stanza) request);
            }
            else if (request instanceof PlainStreamElement){
                connection.send((PlainStreamElement) request);
            } else {
                throw new IllegalStateException("Unsupported element type");
            }
            state = State.RequestSent;
        }
        waitForConditionOrTimeout();
    }
    finally {
        connectionLock.unlock();
    }
    checkForResponse();
}
项目:Smack    文件:SynchronizationPoint.java   
/**
 * Send the given plain stream element and wait for a response.
 *
 * @param request the plain stream element to send.
 * @throws E if an failure was reported.
 * @throws NoResponseException if no response was received.
 * @throws NotConnectedException if the connection is not connected.
 */
public void sendAndWaitForResponseOrThrow(PlainStreamElement request) throws E, NoResponseException,
                NotConnectedException {
    sendAndWaitForResponse(request);
    switch (state) {
    case Failure:
        if (failureException != null) {
            throw failureException;
        }
        break;
    default:
        // Success, do nothing
    }
}
项目:Smack    文件:DummyConnection.java   
@Override
public void send(PlainStreamElement element) {
    if (SmackConfiguration.DEBUG) {
        System.out.println("[SEND]: " + element.toXML());
    }
    queue.add(element);
}
项目:Smack    文件:XMPPBOSHConnection.java   
@Override
public void send(PlainStreamElement element) throws NotConnectedException {
    if (done) {
        throw new NotConnectedException();
    }
    sendElement(element);
}
项目:jmeter-bzm-plugins    文件:XMPPConnectionMock.java   
@Override
public void send(PlainStreamElement element) throws SmackException.NotConnectedException {
    log.debug("Emul sending packet: " + element.toXML());
}
项目:Smack    文件:XMPPTCPConnection.java   
@Override
public void send(PlainStreamElement element) throws NotConnectedException {
    packetWriter.sendStreamElement(element);
}
项目:Smack    文件:AbstractXMPPConnection.java   
@Override
public abstract void send(PlainStreamElement element) throws NotConnectedException;
项目:openyu-commons    文件:PoolableXmppConnection.java   
public void send(PlainStreamElement element) throws NotConnectedException {
    delegate.send(element);
}
项目:Smack    文件:XMPPConnection.java   
/**
 * Send a PlainStreamElement.
 * <p>
 * <b>This method is not meant for end-user usage!</b> It allows sending plain stream elements, which should not be
 * done by a user manually. <b>Doing so may result in a unstable or unusable connection.</b> Certain Smack APIs use
 * this method to send plain stream elements.
 * </p>
 *
 * @param element
 * @throws NotConnectedException
 */
public void send(PlainStreamElement element) throws NotConnectedException;