Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:31:00+00:00 2026-06-15T07:31:00+00:00

RESTEasy provides the Server-side Mock Framework for mocking server requests. Is there an equivalent

  • 0

RESTEasy provides the Server-side Mock Framework for mocking server requests. Is there an equivalent for unit testing the client framework?

Is InMemoryClientExecutor intended for this purpose? I’m having trouble finding documentation and examples of how this class should be used.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:31:01+00:00Added an answer on June 15, 2026 at 7:31 am

    Looks like InMemoryClientExecutor may be used for client-side mocking. Looking in the source, it internally uses the same classes as the server-side mock framework, namely, MockHttpRequest and MockHttpResponse.

    InMemoryClientExecutor gives you the ability to override createResponse for mocking responses and also has a constructor which takes a Dispatcher, if you want to customize and intercept calls that way.

    Here’s a quick and dirty snippet leveraging the client framework example,

    import javax.ws.rs.*;
    import javax.ws.rs.core.Response.*;
    
    import org.jboss.resteasy.client.*;
    import org.jboss.resteasy.client.core.*;
    import org.jboss.resteasy.client.core.executors.*;
    import org.jboss.resteasy.mock.*;
    import org.jboss.resteasy.plugins.providers.*;
    import org.jboss.resteasy.spi.*;
    
    public class InMemoryClientExecutorExample {
        public interface SimpleClient {
           @GET
           @Path("basic")
           @Produces("text/plain")
           String getBasic();
    
           @PUT
           @Path("basic")
           @Consumes("text/plain")
           void putBasic(String body);
    
           @GET
           @Path("queryParam")
           @Produces("text/plain")
           String getQueryParam(@QueryParam("param")String param);
    
           @GET
           @Path("matrixParam")
           @Produces("text/plain")
           String getMatrixParam(@MatrixParam("param")String param);
    
           @GET
           @Path("uriParam/{param}")
           @Produces("text/plain")
           int getUriParam(@PathParam("param")int param);
        }  
    
        public static void main(String[] args) {
            RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
    
            ClientExecutor executor = new InMemoryClientExecutor() {
                @Override
                protected BaseClientResponse<?> createResponse(ClientRequest request, MockHttpResponse mockResponse) {
                    try {                    
                        System.out.println("Client requesting " + request.getHttpMethod() + " on " + request.getUri());
                    }
                    catch(Exception ex) {
                        ex.printStackTrace();
                    }
                    mockResponse.setStatus(Status.OK.getStatusCode());
                    return super.createResponse(request, mockResponse);
                }
            };
    
            SimpleClient client = ProxyFactory.create(SimpleClient.class, "http://localhost:8081", executor);
            client.putBasic("hello world");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using RESTEasy and more specifically, the client side of their framework. I'm calling
Yesterday I tried to use the client side of the RestEasy framework. The interface
RESTEasy mock framework works fine without exception mapper--request is received and entity is returned
I am writing a Resteasy server application and am having trouble getting my superclasses
I am designing a JAX-RS REST Server using Clojure and RESTEasy . It is
I have developed a REST application server based on RESTEasy (JAX-RS). I have a
Is there any way to dump out a list of mapped paths in RESTEasy?
I cannot get JAXB to unmarshal a timestamp in a Resteasy JAX-RS server application.
I'm making a rest api using resteasy , and testing it with rest-assured .
Is there any handy way to use RESTEasy Asynchronous HTTP support (in my case

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.