@Test public void selectNextMessageResponse() { final Connection connection = createConnection(); connection.enqueueResponse( UseCacheMessage.create( null, "0", ValueUtil.randomString() ), null ); assertNull( connection.getCurrentMessageResponse() ); assertEquals( connection.getPendingResponses().size(), 1 ); final boolean selectedMessage = connection.selectNextMessageResponse(); assertTrue( selectedMessage ); final MessageResponse currentMessageResponse = connection.getCurrentMessageResponse(); assertNotNull( currentMessageResponse ); assertEquals( connection.getPendingResponses().size(), 0 ); }
boolean selectNextMessageResponse() { assert null == _currentMessageResponse; if ( !_pendingResponses.isEmpty() ) { _currentMessageResponse = _pendingResponses.remove(); return true; } else { return false; } }
Connection { boolean selectNextMessageResponse() { assert null == _currentMessageResponse; if ( !_pendingResponses.isEmpty() ) { _currentMessageResponse = _pendingResponses.remove(); return true; } else { return false; } } }
Connection { boolean selectNextMessageResponse() { assert null == _currentMessageResponse; if ( !_pendingResponses.isEmpty() ) { _currentMessageResponse = _pendingResponses.remove(); return true; } else { return false; } } Connection( @Nonnull final Connector connector ); }
Connection { boolean selectNextMessageResponse() { assert null == _currentMessageResponse; if ( !_pendingResponses.isEmpty() ) { _currentMessageResponse = _pendingResponses.remove(); return true; } else { return false; } } Connection( @Nonnull final Connector connector );  }
Connection { boolean selectNextMessageResponse() { assert null == _currentMessageResponse; if ( !_pendingResponses.isEmpty() ) { _currentMessageResponse = _pendingResponses.remove(); return true; } else { return false; } } Connection( @Nonnull final Connector connector );   }