boolean remove = false;
if((delivery.getLink() instanceof ReceiverImpl) && delivery.isLocalStateChange())
{
remove = true;
TransportDelivery transportDelivery = delivery.getTransportDelivery();
Disposition disposition = new Disposition();
disposition.setFirst(transportDelivery.getDeliveryId());
disposition.setLast(transportDelivery.getDeliveryId());
disposition.setRole(Role.RECEIVER);
disposition.setSettled(delivery.isSettled());
disposition.setState(delivery.getLocalState());
int frameBytes = writeFrame(buffer, delivery.getLink().getSession()
.getTransportSession().getLocalChannel(),
disposition, null, null);
written += frameBytes;
if(delivery.isSettled())