Search in sources :

Example 6 with Session

use of org.apache.qpid.proton.engine.Session in project vertx-proton by vert-x3.

the class ProtonReceiverImplTest method testDrainWithoutHandlerThrowsIAE.

@Test
public void testDrainWithoutHandlerThrowsIAE() {
    Connection conn = Connection.Factory.create();
    Session sess = conn.session();
    Receiver r = sess.receiver("name");
    ProtonReceiverImpl receiver = new ProtonReceiverImpl(r);
    receiver.setPrefetch(0);
    try {
        receiver.drain(0, null);
        fail("should have thrown due to lack of handler");
    } catch (IllegalArgumentException iae) {
    // Expected
    }
}
Also used : Connection(org.apache.qpid.proton.engine.Connection) ProtonReceiver(io.vertx.proton.ProtonReceiver) Receiver(org.apache.qpid.proton.engine.Receiver) Session(org.apache.qpid.proton.engine.Session) Test(org.junit.Test)

Example 7 with Session

use of org.apache.qpid.proton.engine.Session in project vertx-proton by vert-x3.

the class ProtonReceiverImplTest method testDrainWithoutDisablingPrefetchThrowsISE.

@Test
public void testDrainWithoutDisablingPrefetchThrowsISE() {
    Connection conn = Connection.Factory.create();
    Session sess = conn.session();
    Receiver r = sess.receiver("name");
    ProtonReceiverImpl receiver = new ProtonReceiverImpl(r);
    try {
        receiver.drain(0, h -> {
        });
        fail("should have thrown due to prefetch still being enabled");
    } catch (IllegalStateException ise) {
    // Expected
    }
}
Also used : Connection(org.apache.qpid.proton.engine.Connection) ProtonReceiver(io.vertx.proton.ProtonReceiver) Receiver(org.apache.qpid.proton.engine.Receiver) Session(org.apache.qpid.proton.engine.Session) Test(org.junit.Test)

Aggregations

Connection (org.apache.qpid.proton.engine.Connection)7 Session (org.apache.qpid.proton.engine.Session)7 Test (org.junit.Test)7 Record (org.apache.qpid.proton.engine.Record)4 ProtonReceiver (io.vertx.proton.ProtonReceiver)3 Receiver (org.apache.qpid.proton.engine.Receiver)3 Sender (org.apache.qpid.proton.engine.Sender)3 Delivery (org.apache.qpid.proton.engine.Delivery)1