diff --git a/src/main/java/org/scribe/model/Request.java b/src/main/java/org/scribe/model/Request.java index ddaee41..3392e4d 100644 --- a/src/main/java/org/scribe/model/Request.java +++ b/src/main/java/org/scribe/model/Request.java @@ -36,13 +36,6 @@ class Request this.url = url; this.bodyParams = new HashMap(); this.headers = new HashMap(); - try - { - connection = (HttpURLConnection) new URL(url).openConnection(); - } catch (IOException ioe) - { - throw new OAuthException("Could not open connection to: " + url, ioe); - } } /** @@ -56,6 +49,7 @@ class Request { try { + createConnection(); return doSend(); } catch (IOException ioe) { @@ -63,6 +57,14 @@ class Request } } + private void createConnection() throws IOException + { + if (connection == null) + { + connection = (HttpURLConnection) new URL(url).openConnection(); + } + } + Response doSend() throws IOException { connection.setRequestMethod(this.verb.name());