Skip to content

Instantly share code, notes, and snippets.

@hgoebl
Created April 24, 2014 07:02
Show Gist options
  • Save hgoebl/11244369 to your computer and use it in GitHub Desktop.
Save hgoebl/11244369 to your computer and use it in GitHub Desktop.
package com.goebl.david;
import junit.framework.TestCase;
public class TestSO23260208 extends TestCase {
public void testGet() throws Exception {
Webb webb = Webb.create();
Response<String> response = webb
.get("https://www.goebl.com/robots.tx")
.connectTimeout(3000)
.readTimeout(10000)
.header("User-Agent", "Mozilla/5.0")
.asString();
if (response.isSuccess()) {
assertEquals(200, response.getStatusCode());
assertNotNull(response.getBody());
} else {
System.out.println(response.getStatusCode());
System.out.println(response.getResponseMessage());
System.out.println(response.getErrorBody());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment