private void dispatchBookkeepingRequest(int sequenceNumber, Socket socket) throws InterruptedException { RecordedRequest request = new RecordedRequest( null, null, null, -1, null, sequenceNumber, socket); requestCount.incrementAndGet(); requestQueue.add(request); dispatcher.dispatch(request); }
response = dispatcher.dispatch(request); } catch (InterruptedException e) { throw new AssertionError(e);
requestQueue.add(request); MockResponse response = dispatcher.dispatch(request); if (response.getSocketPolicy() == DISCONNECT_AFTER_REQUEST) { socket.close();
private void dispatchBookkeepingRequest(int sequenceNumber, Socket socket) throws InterruptedException { RecordedRequest request = new RecordedRequest( null, null, null, -1, null, sequenceNumber, socket); requestCount.incrementAndGet(); requestQueue.add(request); dispatcher.dispatch(request); }
requestQueue.add(request); MockResponse response = dispatcher.dispatch(request); if (response.getSocketPolicy() == DISCONNECT_AFTER_REQUEST) { socket.close();
response = dispatcher.dispatch(request); } catch (InterruptedException e) { throw new AssertionError(e);
@Test public void interceptDispatch() throws InterruptedException, IOException { Dispatcher dispatcher = spy(new QueueDispatcher()); server.setDispatcher(dispatcher); server.enqueue(new MockResponse()); execute(); verify(dispatcher).dispatch(any(RecordedRequest.class)); }