stubby4j – Java-based HTTP stub server

I released a Java-based HTTP stub server. We are actually using it on our current project. Give it a go, perhaps it can help you too. In brief, why would you use a stub HTTP server?

  • You want to simulate responses from real server and don’t care (or cannot) to go over the network
  • You want to verify that your code makes HTTP requests with all the required parameters and/or headers
  • You want to verify that your code correctly handles HTTP error codes
  • You want to trigger response from the server based on the request parameters over HTTP or HTTPS
  • You want support for any of the available HTTP methods
  • You want to trigger multiple responses based on multiple requests on the same URI
  • You want to easily configure stub data using configuration file
  • You want to easily configure stub data at runtime, without restarting the server by making a POST to an exposed endpoint
  • You want to easily provide canned answers in your contract/integration tests
  • You don’t want to spend time coding for the above requirements and just want to concentrate on the task at hand
  • Specifiable mock responses to simulate page conditions without real data.
  • Easily swappable data config files to run different data sets and responses.
  • All-in-one stub server to handle mock data with less need to upkeep code for test generation