Package com.google.mockwebserver

Examples of com.google.mockwebserver.QueueDispatcher


    * this method, which allows us to send back links to the mock server.
    */
   private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) {
      final AtomicReference<URL> url = new AtomicReference<URL>();

      final QueueDispatcher dispatcher = new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here


    * method, which allows us to send back links to the mock server.
    */
   private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) {
      final AtomicReference<URL> url = new AtomicReference<URL>();

      final QueueDispatcher dispatcher = new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here

    * this method, which allows us to send back links to the mock server.
    */
   private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) {
      final AtomicReference<URL> url = Atomics.newReference();

      final QueueDispatcher dispatcher = new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here

   /**
    * there's no built-in way to defer evaluation of a response header, hence
    * this method, which allows us to send back links to the mock server.
    */
   public static QueueDispatcher getURLReplacingQueueDispatcher(final URL url) {
      final QueueDispatcher dispatcher = new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here

     * this pattern is used for HATEOAS or similar apis which return urls for
     * further requests. If we don't replace here, the test cannot be bound to
     * the same MWS instance as it was created with.
     */
   private QueueDispatcher replaceURLWithLocalhostPort(final int port) {
      return new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here

    * this method, which allows us to send back links to the mock server.
    */
   private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) {
      final AtomicReference<URL> url = new AtomicReference<URL>();

      final QueueDispatcher dispatcher = new QueueDispatcher() {
         protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

         @Override
         public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
            MockResponse response = responseQueue.take();
View Full Code Here

TOP

Related Classes of com.google.mockwebserver.QueueDispatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.