/** * 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(); }
/** * 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 } }
@Override public void send(PlainStreamElement element) { if (SmackConfiguration.DEBUG) { System.out.println("[SEND]: " + element.toXML()); } queue.add(element); }
@Override public void send(PlainStreamElement element) throws NotConnectedException { if (done) { throw new NotConnectedException(); } sendElement(element); }
@Override public void send(PlainStreamElement element) throws SmackException.NotConnectedException { log.debug("Emul sending packet: " + element.toXML()); }
@Override public void send(PlainStreamElement element) throws NotConnectedException { packetWriter.sendStreamElement(element); }
@Override public abstract void send(PlainStreamElement element) throws NotConnectedException;
public void send(PlainStreamElement element) throws NotConnectedException { delegate.send(element); }
/** * 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;