Comments (7)
Hi,
Would you mind sending me the version of WireMock you're using, whether you're using the standalone JAR and the version of the Apache HTTP client you're using?
Also does your bigLumpOfJson have any unusual characters in it? And is it very large?
Many thanks,
Tom
from wiremock.
No worries
HttpClient is 4.2.3 GA
WireMock is 1.28 - I was not using the standalone JAR, I was driving it around with JUnit
the bigLumpOfJson is only a few hundred bytes in the test case:
{"serviceName":"AttributionEngine","hostName":"localhost","version":"1.0",
"startTime":"20130221T133518Z","status":"ACTIVE","intervals":60,"intervalSize":"minutes",
"serverTime":"20130221T133732Z","javaVersion":"1.7.0_10","counters":[]}
from wiremock.
I've tried to replicate this issue as closely as possible based on the info and code you've given me and everything seems to be working normally. Here's the full test case I used. Perhaps you can spot a crucial difference from what you've done:
package wiremock.test;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.junit.Rule;
import org.junit.Test;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static junit.framework.Assert.assertFalse;
public class AppTest {
@Rule
public WireMockRule wireMockRule = new WireMockRule();
@Test
public void test() throws Exception {
String bigLumpOfJSON = "{\"serviceName\":\"AttributionEngine\",\"hostName\":\"localhost\",\"version\":\"1.0\",\n" +
"\"startTime\":\"20130221T133518Z\",\"status\":\"ACTIVE\",\"intervals\":60,\"intervalSize\":\"minutes\",\n" +
"\"serverTime\":\"20130221T133732Z\",\"javaVersion\":\"1.7.0_10\",\"counters\":[]}";
stubFor(get(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(bigLumpOfJSON)));
final HttpGet request = new HttpGet("http://localhost:8080/some/thing");
final HttpResponse httpResponse = new DefaultHttpClient().execute(request);
final int statusCode = httpResponse.getStatusLine().getStatusCode();
if (HttpStatus.SC_OK == statusCode) {
final HttpEntity entity = httpResponse.getEntity();
if (entity == null) {
throw new RuntimeException("No content in the response");
} else {
final String body = EntityUtils.toString(entity, "UTF-8");
System.out.println(body);
assertFalse(body.isEmpty());
}
} else {
throw new RuntimeException("Server Returned " + statusCode);
}
}
}
from wiremock.
This is profoundly weird. I'm starting to think that the problem is on the HttpClient end, and there is some weird emergent behaviour arising out of the intersection of Ubuntu, 1.7.0_10 and a slightly wonky network configuration. I will keep banging on this to see if I can get any further.
from wiremock.
Right, I'm on a Mac so unfortunately I can't replicate that part. Please
let me know if it does turn out to be a bug or some kind of OS interaction
- trying to make it as robust as possible!
Thanks,
Tom
On 27 February 2013 09:41, Robert Hook [email protected] wrote:
This is profoundly weird. I'm starting to think that the problem is on the
HttpClient end, and there is some weird emergent behaviour arising out of
the intersection of Ubuntu, 1.7.0_10 and a slightly wonky network
configuration. I will keep banging on this to see if I can get any further.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-14164874
.
from wiremock.
Will do. I will work with the test case you've built above on several different platforms and see what comes out.
ADDENDUM: the plot thickens - the test case above is now working on the combination of Ubuntu and 1.7.0_10, strongly suggesting some wonkiness in the network configuration has become involved.
ADDENDUM 2: I loathe Heisenbugs (http://www.catb.org/jargon/html/H/heisenbug.html). I cannot reproduce this fault at all now. There are two things that have changed: Commons IO was bumped from 2.3 to 2.4, and our network is not as flaky as it was on Thursday when the problem manifested. I will continue to monitor the behaviour in our environment, but at this stage think that the issue can be closed off as "problem exists between keyboard and chair".
I have moved our testing fully to WireMock, and directed my team to run forward with it - it's exactly right solution for our requirements.
from wiremock.
Thanks for the feedback. Good to hear its proving to be useful!
HTTPS support to be released shortly if that's of any interest.
from wiremock.
Related Issues (20)
- Update org.xmlutil:xmlunit-core to Version 2.10.0 HOT 2
- Introduce a GUI for open source HOT 1
- NPE on WireMockServer.getServeEvents when using a StubRequestFilter HOT 1
- Adding more jettyAcceptors seems to do nothing besides cause thread contention. HOT 1
- align new join handlebar helper with features present in the join provided in the library, but not covered yet
- Expose args in Options so extensions can read it
- Possible memory leak ? HOT 15
- Prevent creating multiple stub mappings with the same ID HOT 1
- Support virtual threads in Jetty server for standalone deploy
- Error when proxying to a host that is only accessible via IPv6 HOT 1
- Formatted dates not in UTC
- __files created by default since v3.6.0 HOT 1
- absent operand must be a non-null string
- Array and data manipulation in handlebars template when using docker
- FileItemPartAdapter returning multipart's field name instead of a filename
- Avoiding reading zipfile entries repeatedly in ClasspathFileSource
- Support disabled state for stub mappings HOT 1
- Add a unique id to the template request model
- Add self-description callback(s) to MatchResult for use in Diff
- Report webhook errors and results as sub-events
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiremock.