@Test public void testRecvAllAsReadableBufferWhenEmpty() throws Exception { DeliveryImpl delivery = new DeliveryImpl(null, Mockito.mock(LinkImpl.class), null); ReadableBuffer payload = delivery.recv(); assertNotNull(payload); assertEquals(0, payload.remaining()); }
int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; }
DeliveryImpl implements Delivery { int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; } }
DeliveryImpl implements Delivery { int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; } DeliveryImpl(final byte[] tag, final LinkImpl link, DeliveryImpl previous); }
DeliveryImpl implements Delivery { int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; } DeliveryImpl(final byte[] tag, final LinkImpl link, DeliveryImpl previous); @Override byte[] getTag(); @Override LinkImpl getLink(); @Override DeliveryState getLocalState(); @Override DeliveryState getRemoteState(); @Override boolean remotelySettled(); @Override void setMessageFormat(int messageFormat); @Override int getMessageFormat(); @Override void disposition(final DeliveryState state); @Override void settle(); @Override DeliveryImpl next(); @Override void free(); @Override DeliveryImpl getWorkNext(); @Override boolean isSettled(); @Override int available(); @Override boolean isWritable(); @Override boolean isReadable(); @Override boolean isAborted(); @Override boolean isPartial(); @Override boolean isUpdated(); @Override void clear(); @Override boolean isBuffered(); @Override Object getContext(); @Override void setContext(Object context); @Override Record attachments(); @Override String toString(); @Override int pending(); @Override void setDefaultDeliveryState(DeliveryState state); @Override DeliveryState getDefaultDeliveryState(); }
DeliveryImpl implements Delivery { int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; } DeliveryImpl(final byte[] tag, final LinkImpl link, DeliveryImpl previous); @Override byte[] getTag(); @Override LinkImpl getLink(); @Override DeliveryState getLocalState(); @Override DeliveryState getRemoteState(); @Override boolean remotelySettled(); @Override void setMessageFormat(int messageFormat); @Override int getMessageFormat(); @Override void disposition(final DeliveryState state); @Override void settle(); @Override DeliveryImpl next(); @Override void free(); @Override DeliveryImpl getWorkNext(); @Override boolean isSettled(); @Override int available(); @Override boolean isWritable(); @Override boolean isReadable(); @Override boolean isAborted(); @Override boolean isPartial(); @Override boolean isUpdated(); @Override void clear(); @Override boolean isBuffered(); @Override Object getContext(); @Override void setContext(Object context); @Override Record attachments(); @Override String toString(); @Override int pending(); @Override void setDefaultDeliveryState(DeliveryState state); @Override DeliveryState getDefaultDeliveryState(); static final int DEFAULT_MESSAGE_FORMAT; }