Remove upper case constants (#63)

* Remove usage of upper-case constants.

* Uupdate SDK version
* remove stable from Travis config
diff --git a/.travis.yml b/.travis.yml
index 0f61077..99e217e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,6 @@
     fi
 
 dart:
-  - stable
   - dev
 
 dart_task:
diff --git a/lib/src/http_headers_impl.dart b/lib/src/http_headers_impl.dart
index e2b464c..5dcffce 100644
--- a/lib/src/http_headers_impl.dart
+++ b/lib/src/http_headers_impl.dart
@@ -596,7 +596,7 @@
     for (var i = 0; i < field.length; i++) {
       if (!CharCode.isTokenChar(field.codeUnitAt(i))) {
         throw new FormatException(
-            "Invalid HTTP header field name: ${JSON.encode(field)}");
+            "Invalid HTTP header field name: ${jsonEncode(field)}");
       }
     }
     return field.toLowerCase();
@@ -607,7 +607,7 @@
       for (var i = 0; i < value.length; i++) {
         if (!CharCode.isValueChar(value.codeUnitAt(i))) {
           throw new FormatException(
-              "Invalid HTTP header field value: ${JSON.encode(value)}");
+              "Invalid HTTP header field value: ${jsonEncode(value)}");
         }
       }
     }
diff --git a/lib/src/http_impl.dart b/lib/src/http_impl.dart
index f3ca8f2..0a1b76b 100644
--- a/lib/src/http_impl.dart
+++ b/lib/src/http_impl.dart
@@ -1586,7 +1586,7 @@
       // If the proxy configuration contains user information use that
       // for proxy basic authorization.
       String auth = CryptoUtils
-          .bytesToBase64(UTF8.encode("${proxy.username}:${proxy.password}"));
+          .bytesToBase64(utf8.encode("${proxy.username}:${proxy.password}"));
       request.headers.set(HttpHeaders.PROXY_AUTHORIZATION, "Basic $auth");
     } else if (!proxy.isDirect && _httpClient._proxyCredentials.isNotEmpty) {
       proxyCreds = _httpClient._findProxyCredentials(proxy);
@@ -1597,7 +1597,7 @@
     if (uri.userInfo != null && uri.userInfo.isNotEmpty) {
       // If the URL contains user information use that for basic
       // authorization.
-      String auth = CryptoUtils.bytesToBase64(UTF8.encode(uri.userInfo));
+      String auth = CryptoUtils.bytesToBase64(utf8.encode(uri.userInfo));
       request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth");
     } else {
       // Look for credentials.
@@ -1708,7 +1708,7 @@
       // If the proxy configuration contains user information use that
       // for proxy basic authorization.
       String auth = CryptoUtils
-          .bytesToBase64(UTF8.encode("${proxy.username}:${proxy.password}"));
+          .bytesToBase64(utf8.encode("${proxy.username}:${proxy.password}"));
       request.headers.set(HttpHeaders.PROXY_AUTHORIZATION, "Basic $auth");
     }
     return request.close().then((response) {
@@ -2783,11 +2783,11 @@
       // now always use UTF-8 encoding.
       _HttpClientDigestCredentials creds = credentials;
       var hasher = new MD5()
-        ..add(UTF8.encode(creds.username))
+        ..add(utf8.encode(creds.username))
         ..add([CharCode.COLON])
         ..add(realm.codeUnits)
         ..add([CharCode.COLON])
-        ..add(UTF8.encode(creds.password));
+        ..add(utf8.encode(creds.password));
       ha1 = CryptoUtils.bytesToHex(hasher.close());
     }
   }
@@ -2869,7 +2869,7 @@
     // Proxy-Authenticate headers, see
     // http://tools.ietf.org/html/draft-reschke-basicauth-enc-06. For
     // now always use UTF-8 encoding.
-    String auth = CryptoUtils.bytesToBase64(UTF8.encode("$username:$password"));
+    String auth = CryptoUtils.bytesToBase64(utf8.encode("$username:$password"));
     return "Basic $auth";
   }
 
diff --git a/pubspec.yaml b/pubspec.yaml
index bb6937e..a2a5763 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,10 +1,10 @@
 name: http_io
-version: 0.10.0-dev
+version: 0.10.0
 author: "Dart Team <misc@dartlang.org>"
 homepage: https://github.com/dart-lang/http_io
 description: HTTP Client and Server APIs.
 environment:
-  sdk: ">=1.24.0 <2.0.0"
+  sdk: ">=2.0.0-dev.17.0 <2.0.0"
 dev_dependencies:
   convert: "^2.0.1"
   crypto: "^2.0.2+1"
diff --git a/test/http_100_continue_test.dart b/test/http_100_continue_test.dart
index 9b284c6..2a953e5 100644
--- a/test/http_100_continue_test.dart
+++ b/test/http_100_continue_test.dart
@@ -69,12 +69,12 @@
 AB''';
 
   test("Continue OK", () async {
-    await doTest(ASCII.encode(r1), 0);
+    await doTest(ascii.encode(r1), 0);
   });
   test("Continue hello world OK", () async {
-    await doTest(ASCII.encode(r2), 0);
+    await doTest(ascii.encode(r2), 0);
   });
   test("Continue OK length AB", () async {
-    await doTest(ASCII.encode(r3), 2);
+    await doTest(ascii.encode(r3), 2);
   });
 }
diff --git a/test/http_auth_test.dart b/test/http_auth_test.dart
index 1942781..6688bcb 100644
--- a/test/http_auth_test.dart
+++ b/test/http_auth_test.dart
@@ -39,7 +39,7 @@
           String authorization = request.headers[HttpHeaders.AUTHORIZATION][0];
           List<String> tokens = authorization.split(" ");
           expect("Basic", equals(tokens[0]));
-          String auth = BASE64.encode(UTF8.encode("$username:$password"));
+          String auth = base64Encode(utf8.encode("$username:$password"));
           if (passwordChanged && auth != tokens[1]) {
             response.statusCode = HttpStatus.UNAUTHORIZED;
             response.headers
diff --git a/test/http_client_connect_test.dart b/test/http_client_connect_test.dart
index f406a55..cdb481c 100644
--- a/test/http_client_connect_test.dart
+++ b/test/http_client_connect_test.dart
@@ -238,7 +238,7 @@
         .then((request) => request.close())
         .then((clientResponse) {
       var iterator = new StreamIterator(
-          clientResponse.transform(UTF8.decoder).transform(new LineSplitter()));
+          clientResponse.transform(utf8.decoder).transform(new LineSplitter()));
       iterator.moveNext().then((hasValue) {
         expect(hasValue, isTrue);
         expect('init', equals(iterator.current));
diff --git a/test/http_cookie_date_test.dart b/test/http_cookie_date_test.dart
index 4baa3c8..e5ea628 100644
--- a/test/http_cookie_date_test.dart
+++ b/test/http_cookie_date_test.dart
@@ -18,11 +18,11 @@
     expect(date, parseCookieDate(formatted));
   }
 
-  test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
-  test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
-  test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
-  test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
-  test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
+  test(2012, DateTime.june, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
+  test(2021, DateTime.june, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
+  test(2021, DateTime.january, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
+  test(2013, DateTime.january, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
+  test(1970, DateTime.january, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
 }
 
 void main() {
diff --git a/test/http_date_test.dart b/test/http_date_test.dart
index 47c5e30..a8d07e0 100644
--- a/test/http_date_test.dart
+++ b/test/http_date_test.dart
@@ -7,17 +7,17 @@
 
 void testParseHttpDate() {
   DateTime date;
-  date = new DateTime.utc(1999, DateTime.JUNE, 11, 18, 46, 53, 0);
+  date = new DateTime.utc(1999, DateTime.june, 11, 18, 46, 53, 0);
   expect(date, HttpDate.parse("Fri, 11 Jun 1999 18:46:53 GMT"));
   expect(date, HttpDate.parse("Friday, 11-Jun-1999 18:46:53 GMT"));
   expect(date, HttpDate.parse("Fri Jun 11 18:46:53 1999"));
 
-  date = new DateTime.utc(1970, DateTime.JANUARY, 1, 0, 0, 0, 0);
+  date = new DateTime.utc(1970, DateTime.january, 1, 0, 0, 0, 0);
   expect(date, HttpDate.parse("Thu, 1 Jan 1970 00:00:00 GMT"));
   expect(date, HttpDate.parse("Thursday, 1-Jan-1970 00:00:00 GMT"));
   expect(date, HttpDate.parse("Thu Jan  1 00:00:00 1970"));
 
-  date = new DateTime.utc(2012, DateTime.MARCH, 5, 23, 59, 59, 0);
+  date = new DateTime.utc(2012, DateTime.march, 5, 23, 59, 59, 0);
   expect(date, HttpDate.parse("Mon, 5 Mar 2012 23:59:59 GMT"));
   expect(date, HttpDate.parse("Monday, 5-Mar-2012 23:59:59 GMT"));
   expect(date, HttpDate.parse("Mon Mar  5 23:59:59 2012"));
@@ -34,10 +34,10 @@
     expect(date, HttpDate.parse(formatted));
   }
 
-  test(1999, DateTime.JUNE, 11, 18, 46, 53, "Fri, 11 Jun 1999 18:46:53 GMT");
-  test(1970, DateTime.JANUARY, 1, 0, 0, 0, "Thu, 01 Jan 1970 00:00:00 GMT");
-  test(1970, DateTime.JANUARY, 1, 9, 9, 9, "Thu, 01 Jan 1970 09:09:09 GMT");
-  test(2012, DateTime.MARCH, 5, 23, 59, 59, "Mon, 05 Mar 2012 23:59:59 GMT");
+  test(1999, DateTime.june, 11, 18, 46, 53, "Fri, 11 Jun 1999 18:46:53 GMT");
+  test(1970, DateTime.january, 1, 0, 0, 0, "Thu, 01 Jan 1970 00:00:00 GMT");
+  test(1970, DateTime.january, 1, 9, 9, 9, "Thu, 01 Jan 1970 09:09:09 GMT");
+  test(2012, DateTime.march, 5, 23, 59, 59, "Mon, 05 Mar 2012 23:59:59 GMT");
 }
 
 void testParseHttpDateFailures() {
diff --git a/test/http_headers_test.dart b/test/http_headers_test.dart
index a812449..08ac899 100644
--- a/test/http_headers_test.dart
+++ b/test/http_headers_test.dart
@@ -43,9 +43,9 @@
 }
 
 void testDate() {
-  DateTime date1 = new DateTime.utc(1999, DateTime.JUNE, 11, 18, 46, 53, 0);
+  DateTime date1 = new DateTime.utc(1999, DateTime.june, 11, 18, 46, 53, 0);
   String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT";
-  DateTime date2 = new DateTime.utc(2000, DateTime.AUGUST, 16, 12, 34, 56, 0);
+  DateTime date2 = new DateTime.utc(2000, DateTime.august, 16, 12, 34, 56, 0);
   String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT";
 
   HttpHeadersImpl headers = new HttpHeadersImpl("1.1");
@@ -69,9 +69,9 @@
 }
 
 void testExpires() {
-  DateTime date1 = new DateTime.utc(1999, DateTime.JUNE, 11, 18, 46, 53, 0);
+  DateTime date1 = new DateTime.utc(1999, DateTime.june, 11, 18, 46, 53, 0);
   String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT";
-  DateTime date2 = new DateTime.utc(2000, DateTime.AUGUST, 16, 12, 34, 56, 0);
+  DateTime date2 = new DateTime.utc(2000, DateTime.august, 16, 12, 34, 56, 0);
   String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT";
 
   HttpHeadersImpl headers = new HttpHeadersImpl("1.1");
@@ -95,9 +95,9 @@
 }
 
 void testIfModifiedSince() {
-  DateTime date1 = new DateTime.utc(1999, DateTime.JUNE, 11, 18, 46, 53, 0);
+  DateTime date1 = new DateTime.utc(1999, DateTime.june, 11, 18, 46, 53, 0);
   String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT";
-  DateTime date2 = new DateTime.utc(2000, DateTime.AUGUST, 16, 12, 34, 56, 0);
+  DateTime date2 = new DateTime.utc(2000, DateTime.august, 16, 12, 34, 56, 0);
   String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT";
 
   HttpHeadersImpl headers = new HttpHeadersImpl("1.1");
@@ -394,7 +394,7 @@
     Cookie cookie;
     cookie = new Cookie(name, value);
     expect("$name=$value; HttpOnly", cookie.toString());
-    DateTime date = new DateTime.utc(2014, DateTime.JANUARY, 5, 23, 59, 59, 0);
+    DateTime date = new DateTime.utc(2014, DateTime.january, 5, 23, 59, 59, 0);
     cookie.expires = date;
     checkCookie(
         cookie,