hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [2/3] httpcomponents-core git commit: Line ending normalization (no functional changes)
Date Thu, 15 Jun 2017 13:25:07 GMT
Line ending normalization (no functional changes)


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d7768b2c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d7768b2c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d7768b2c

Branch: refs/heads/master
Commit: d7768b2cdb59ca2f8dddf11dc4148e34420f8f86
Parents: 8b5b5ba
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Jun 15 15:15:44 2017 +0200
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Jun 15 15:16:07 2017 +0200

----------------------------------------------------------------------
 .../framework/TestClientTestingAdapter.java     | 106 ++--
 .../testing/framework/TestFrameworkTest.java    | 230 ++++----
 .../hc/core5/http/protocol/LookupRegistry.java  | 118 ++--
 .../hc/core5/http/protocol/UriRegexMatcher.java | 238 ++++----
 .../java/org/apache/hc/core5/net/Ports.java     | 136 ++---
 .../org/apache/hc/core5/util/TimeValue.java     | 578 +++++++++----------
 .../java/org/apache/hc/core5/util/Timeout.java  | 422 +++++++-------
 .../TestAsyncServerExchangeHandlerRegistry.java | 146 ++---
 .../http/protocol/TestUriRegexMatcher.java      | 422 +++++++-------
 .../org/apache/hc/core5/util/TestTimeValue.java | 314 +++++-----
 .../org/apache/hc/core5/util/TestTimeout.java   | 368 ++++++------
 11 files changed, 1539 insertions(+), 1539 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientTestingAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientTestingAdapter.java
index 1f56fad..62af90f 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientTestingAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientTestingAdapter.java
@@ -1,53 +1,53 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.core5.testing.framework;
-
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestClientTestingAdapter {
-
-    @Test
-    public void getHttpClientPOJOAdapter() throws Exception {
-        final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
-
-        final ClientPOJOAdapter pojoAdapter = adapter.getClientPOJOAdapter();
-
-        Assert.assertNotNull("pojoAdapter should not be null", pojoAdapter);
-    }
-
-    @Test
-    public void isRequestSupported() throws Exception {
-        final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
-
-        final Map<String, Object> request = null;
-        Assert.assertTrue("isRequestSupported should return true", adapter.isRequestSupported(request));
-
-    }
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.testing.framework;
+
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestClientTestingAdapter {
+
+    @Test
+    public void getHttpClientPOJOAdapter() throws Exception {
+        final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
+
+        final ClientPOJOAdapter pojoAdapter = adapter.getClientPOJOAdapter();
+
+        Assert.assertNotNull("pojoAdapter should not be null", pojoAdapter);
+    }
+
+    @Test
+    public void isRequestSupported() throws Exception {
+        final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
+
+        final Map<String, Object> request = null;
+        Assert.assertTrue("isRequestSupported should return true", adapter.isRequestSupported(request));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
index 095c215..7b36152 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
@@ -1,115 +1,115 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.testing.framework;
-
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.BODY;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.CONTENT_TYPE;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.HEADERS;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.METHOD;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.PROTOCOL_VERSION;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.QUERY;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.REQUEST;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.RESPONSE;
-import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.STATUS;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestFrameworkTest {
-    @Test
-    public void defaults() throws Exception {
-        final FrameworkTest test = new FrameworkTest();
-        final Map<String, Object> request = test.initRequest();
-
-        Assert.assertNotNull("request should not be null", request);
-        Assert.assertEquals("Default method should be GET", "GET", request.get(METHOD));
-
-        Assert.assertEquals("Default request body expected.",
-                TestingFramework.DEFAULT_REQUEST_BODY,
-                request.get(BODY));
-
-        Assert.assertEquals("Default request content type expected.",
-                TestingFramework.DEFAULT_REQUEST_CONTENT_TYPE,
-                request.get(CONTENT_TYPE));
-
-        Assert.assertEquals("Default request query parameters expected.",
-                            TestingFramework.DEFAULT_REQUEST_QUERY,
-                            request.get(QUERY));
-
-        Assert.assertEquals("Default request headers expected.",
-                            TestingFramework.DEFAULT_REQUEST_HEADERS,
-                            request.get(HEADERS));
-
-        Assert.assertEquals("Default protocol version expected.",
-                TestingFramework.DEFAULT_REQUEST_PROTOCOL_VERSION,
-                request.get(PROTOCOL_VERSION));
-
-        final Map<String, Object> responseExpectations = test.initResponseExpectations();
-        Assert.assertNotNull("responseExpectations should not be null", responseExpectations);
-        Assert.assertEquals("Default status expected.", TestingFramework.DEFAULT_RESPONSE_STATUS,
-                            responseExpectations.get(STATUS));
-
-        Assert.assertEquals("Default body expected.", TestingFramework.DEFAULT_RESPONSE_BODY,
-                            responseExpectations.get(BODY));
-
-        Assert.assertEquals("Default response content type expected.", TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE,
-                responseExpectations.get(CONTENT_TYPE));
-
-        Assert.assertEquals("Default headers expected.", TestingFramework.DEFAULT_RESPONSE_HEADERS,
-                            responseExpectations.get(HEADERS));
-    }
-
-    @Test
-    public void changeStatus() throws Exception {
-        final Map<String, Object> testMap = new HashMap<String, Object>();
-        final Map<String, Object> response = new HashMap<String, Object>();
-        testMap.put(RESPONSE, response);
-        response.put(STATUS, 201);
-
-        final FrameworkTest test = new FrameworkTest(testMap);
-        final Map<String, Object> responseExpectations = test.initResponseExpectations();
-
-        Assert.assertEquals("Status unexpected.", 201, responseExpectations.get(STATUS));
-    }
-
-    @Test
-    public void changeMethod() throws Exception {
-        final Map<String, Object> testMap = new HashMap<String, Object>();
-        final Map<String, Object> request = new HashMap<String, Object>();
-        testMap.put(REQUEST, request);
-        request.put(METHOD, "POST");
-
-        final FrameworkTest test = new FrameworkTest(testMap);
-        final Map<String, Object> requestExpectations = test.initRequest();
-
-        Assert.assertEquals("Method unexpected.", "POST", requestExpectations.get(METHOD));
-    }
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.framework;
+
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.BODY;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.CONTENT_TYPE;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.HEADERS;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.METHOD;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.PROTOCOL_VERSION;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.QUERY;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.REQUEST;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.RESPONSE;
+import static org.apache.hc.core5.testing.framework.ClientPOJOAdapter.STATUS;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestFrameworkTest {
+    @Test
+    public void defaults() throws Exception {
+        final FrameworkTest test = new FrameworkTest();
+        final Map<String, Object> request = test.initRequest();
+
+        Assert.assertNotNull("request should not be null", request);
+        Assert.assertEquals("Default method should be GET", "GET", request.get(METHOD));
+
+        Assert.assertEquals("Default request body expected.",
+                TestingFramework.DEFAULT_REQUEST_BODY,
+                request.get(BODY));
+
+        Assert.assertEquals("Default request content type expected.",
+                TestingFramework.DEFAULT_REQUEST_CONTENT_TYPE,
+                request.get(CONTENT_TYPE));
+
+        Assert.assertEquals("Default request query parameters expected.",
+                            TestingFramework.DEFAULT_REQUEST_QUERY,
+                            request.get(QUERY));
+
+        Assert.assertEquals("Default request headers expected.",
+                            TestingFramework.DEFAULT_REQUEST_HEADERS,
+                            request.get(HEADERS));
+
+        Assert.assertEquals("Default protocol version expected.",
+                TestingFramework.DEFAULT_REQUEST_PROTOCOL_VERSION,
+                request.get(PROTOCOL_VERSION));
+
+        final Map<String, Object> responseExpectations = test.initResponseExpectations();
+        Assert.assertNotNull("responseExpectations should not be null", responseExpectations);
+        Assert.assertEquals("Default status expected.", TestingFramework.DEFAULT_RESPONSE_STATUS,
+                            responseExpectations.get(STATUS));
+
+        Assert.assertEquals("Default body expected.", TestingFramework.DEFAULT_RESPONSE_BODY,
+                            responseExpectations.get(BODY));
+
+        Assert.assertEquals("Default response content type expected.", TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE,
+                responseExpectations.get(CONTENT_TYPE));
+
+        Assert.assertEquals("Default headers expected.", TestingFramework.DEFAULT_RESPONSE_HEADERS,
+                            responseExpectations.get(HEADERS));
+    }
+
+    @Test
+    public void changeStatus() throws Exception {
+        final Map<String, Object> testMap = new HashMap<String, Object>();
+        final Map<String, Object> response = new HashMap<String, Object>();
+        testMap.put(RESPONSE, response);
+        response.put(STATUS, 201);
+
+        final FrameworkTest test = new FrameworkTest(testMap);
+        final Map<String, Object> responseExpectations = test.initResponseExpectations();
+
+        Assert.assertEquals("Status unexpected.", 201, responseExpectations.get(STATUS));
+    }
+
+    @Test
+    public void changeMethod() throws Exception {
+        final Map<String, Object> testMap = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<String, Object>();
+        testMap.put(REQUEST, request);
+        request.put(METHOD, "POST");
+
+        final FrameworkTest test = new FrameworkTest(testMap);
+        final Map<String, Object> requestExpectations = test.initRequest();
+
+        Assert.assertEquals("Method unexpected.", "POST", requestExpectations.get(METHOD));
+    }
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/LookupRegistry.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/LookupRegistry.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/LookupRegistry.java
index d37b2c0..2bddaf2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/LookupRegistry.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/LookupRegistry.java
@@ -1,59 +1,59 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.core5.http.protocol;
-
-/**
- * A lookup registry.
- *
- * @param <T> The type of objects to register and lookup.
- */
-public interface LookupRegistry<T> {
-
-    /**
-     * Registers the given object for URIs matching the given pattern.
-     *
-     * @param pattern the pattern to register the handler for.
-     * @param obj the object.
-     */
-    void register(String pattern, T obj);
-
-    /**
-     * Looks up an object matching the given request path.
-     *
-     * @param value the request path
-     * @return object or {@code null} if no match is found.
-     */
-    T lookup(String value);
-
-    /**
-     * Removes registered object, if exists, for the given pattern.
-     *
-     * @param pattern the pattern to unregister.
-     */
-    void unregister(String pattern);
-
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.http.protocol;
+
+/**
+ * A lookup registry.
+ *
+ * @param <T> The type of objects to register and lookup.
+ */
+public interface LookupRegistry<T> {
+
+    /**
+     * Registers the given object for URIs matching the given pattern.
+     *
+     * @param pattern the pattern to register the handler for.
+     * @param obj the object.
+     */
+    void register(String pattern, T obj);
+
+    /**
+     * Looks up an object matching the given request path.
+     *
+     * @param value the request path
+     * @return object or {@code null} if no match is found.
+     */
+    T lookup(String value);
+
+    /**
+     * Removes registered object, if exists, for the given pattern.
+     *
+     * @param pattern the pattern to unregister.
+     */
+    void unregister(String pattern);
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriRegexMatcher.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriRegexMatcher.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriRegexMatcher.java
index d24e53b..c833036 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriRegexMatcher.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriRegexMatcher.java
@@ -1,119 +1,119 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.http.protocol;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Pattern;
-
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.util.Args;
-
-/**
- * Maintains a map of objects keyed by a request URI regular expression.
- *
- * <p>
- * The insertion order is in maintained in that map such that the lookup tests each regex until there is a match. This
- * class can be used to resolve an object matching a particular request URI.
- * </p>
- *
- * @since 5.0
- */
-@Contract(threading = ThreadingBehavior.SAFE)
-public class UriRegexMatcher<T> implements LookupRegistry<T> {
-
-    private final Map<String, T> objectMap;
-    private final Map<String, Pattern> patternMap;
-
-    public UriRegexMatcher() {
-        super();
-        this.objectMap = new LinkedHashMap<>();
-        this.patternMap = new LinkedHashMap<>();
-    }
-
-    /**
-     * Registers the given object for URIs matching the given regex.
-     *
-     * @param regex
-     *            the regex to register the handler for.
-     * @param obj
-     *            the object.
-     */
-    @Override
-    public synchronized void register(final String regex, final T obj) {
-        Args.notNull(regex, "URI request regex");
-        this.objectMap.put(regex, obj);
-        this.patternMap.put(regex, Pattern.compile(regex));
-    }
-
-    /**
-     * Removes registered object, if exists, for the given regex.
-     *
-     * @param regex
-     *            the regex to unregister.
-     */
-    @Override
-    public synchronized void unregister(final String regex) {
-        if (regex == null) {
-            return;
-        }
-        this.objectMap.remove(regex);
-        this.patternMap.remove(regex);
-    }
-
-    /**
-     * Looks up an object matching the given request path.
-     *
-     * @param path
-     *            the request path
-     * @return object or {@code null} if no match is found.
-     */
-    @Override
-    public synchronized T lookup(final String path) {
-        Args.notNull(path, "Request path");
-        // direct match?
-        final T obj = this.objectMap.get(path);
-        if (obj == null) {
-            // regex match?
-            for (final Entry<String, Pattern> entry : this.patternMap.entrySet()) {
-                if (entry.getValue().matcher(path).matches()) {
-                    return objectMap.get(entry.getKey());
-                }
-            }
-        }
-        return obj;
-    }
-
-    @Override
-    public String toString() {
-        return this.objectMap.toString();
-    }
-
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http.protocol;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.util.Args;
+
+/**
+ * Maintains a map of objects keyed by a request URI regular expression.
+ *
+ * <p>
+ * The insertion order is in maintained in that map such that the lookup tests each regex until there is a match. This
+ * class can be used to resolve an object matching a particular request URI.
+ * </p>
+ *
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.SAFE)
+public class UriRegexMatcher<T> implements LookupRegistry<T> {
+
+    private final Map<String, T> objectMap;
+    private final Map<String, Pattern> patternMap;
+
+    public UriRegexMatcher() {
+        super();
+        this.objectMap = new LinkedHashMap<>();
+        this.patternMap = new LinkedHashMap<>();
+    }
+
+    /**
+     * Registers the given object for URIs matching the given regex.
+     *
+     * @param regex
+     *            the regex to register the handler for.
+     * @param obj
+     *            the object.
+     */
+    @Override
+    public synchronized void register(final String regex, final T obj) {
+        Args.notNull(regex, "URI request regex");
+        this.objectMap.put(regex, obj);
+        this.patternMap.put(regex, Pattern.compile(regex));
+    }
+
+    /**
+     * Removes registered object, if exists, for the given regex.
+     *
+     * @param regex
+     *            the regex to unregister.
+     */
+    @Override
+    public synchronized void unregister(final String regex) {
+        if (regex == null) {
+            return;
+        }
+        this.objectMap.remove(regex);
+        this.patternMap.remove(regex);
+    }
+
+    /**
+     * Looks up an object matching the given request path.
+     *
+     * @param path
+     *            the request path
+     * @return object or {@code null} if no match is found.
+     */
+    @Override
+    public synchronized T lookup(final String path) {
+        Args.notNull(path, "Request path");
+        // direct match?
+        final T obj = this.objectMap.get(path);
+        if (obj == null) {
+            // regex match?
+            for (final Entry<String, Pattern> entry : this.patternMap.entrySet()) {
+                if (entry.getValue().matcher(path).matches()) {
+                    return objectMap.get(entry.getKey());
+                }
+            }
+        }
+        return obj;
+    }
+
+    @Override
+    public String toString() {
+        return this.objectMap.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/main/java/org/apache/hc/core5/net/Ports.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/net/Ports.java b/httpcore5/src/main/java/org/apache/hc/core5/net/Ports.java
index 51b7bf6..c8938c7 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/net/Ports.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/net/Ports.java
@@ -1,68 +1,68 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.core5.net;
-
-import org.apache.hc.core5.util.Args;
-
-/**
- * Port helper methods.
- *
- * @since 5.0
- */
-public class Ports {
-
-    /**
-     * The scheme default port.
-     */
-    public final static int SCHEME_DEFAULT = -1;
-
-    /**
-     * The minimum port value per https://tools.ietf.org/html/rfc6335.
-     */
-    public final static int MIN_VALUE = 0;
-
-    /**
-     * The maxium port value per https://tools.ietf.org/html/rfc6335.
-     */
-    public final static int MAX_VALUE = 65535;
-
-    /**
-     * Checks a port number where {@code -1} indicates the scheme default port.
-     *
-     * @param port
-     *            The port to check where {@code -1} indicates the scheme default port.
-     * @return the port
-     *
-     * @throws IllegalArgumentException
-     *             If the port parameter is outside the specified range of valid port values, which is between 0 and
-     *             65535, inclusive. {@code -1} indicates the scheme default port.
-     */
-    public static int check(final int port) {
-        return Args.checkRange(port, SCHEME_DEFAULT, MAX_VALUE,
-                "Port number(Use -1 to specify the scheme default port)");
-    }
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.net;
+
+import org.apache.hc.core5.util.Args;
+
+/**
+ * Port helper methods.
+ *
+ * @since 5.0
+ */
+public class Ports {
+
+    /**
+     * The scheme default port.
+     */
+    public final static int SCHEME_DEFAULT = -1;
+
+    /**
+     * The minimum port value per https://tools.ietf.org/html/rfc6335.
+     */
+    public final static int MIN_VALUE = 0;
+
+    /**
+     * The maxium port value per https://tools.ietf.org/html/rfc6335.
+     */
+    public final static int MAX_VALUE = 65535;
+
+    /**
+     * Checks a port number where {@code -1} indicates the scheme default port.
+     *
+     * @param port
+     *            The port to check where {@code -1} indicates the scheme default port.
+     * @return the port
+     *
+     * @throws IllegalArgumentException
+     *             If the port parameter is outside the specified range of valid port values, which is between 0 and
+     *             65535, inclusive. {@code -1} indicates the scheme default port.
+     */
+    public static int check(final int port) {
+        return Args.checkRange(port, SCHEME_DEFAULT, MAX_VALUE,
+                "Port number(Use -1 to specify the scheme default port)");
+    }
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
index d81253a..a8646ca 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
@@ -1,289 +1,289 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.util;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-
-/**
- * Represents a time value as a {@code long} time and {@link TimeUnit}.
- *
- * @since 5.0
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class TimeValue {
-
-    static final int INT_UNDEFINED = -1;
-    public static final TimeValue NEG_ONE_MILLISECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.MILLISECONDS);
-    public static final TimeValue NEG_ONE_SECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.SECONDS);
-    public static final TimeValue ZERO_MILLISECONDS = TimeValue.of(0, TimeUnit.MILLISECONDS);
-
-    /**
-     * Returns the given {@code long} value as an {@code int} where long values out of int range are returned as
-     * {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
-     *
-     * <p>
-     * For example: {@code TimeValue.asBoundInt(Long.MAX_VALUE)} returns {@code Integer.MAX_VALUE}.
-     * </p>
-     *
-     * @param value
-     *            a long value to convert
-     * @return an int value bound within {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
-     */
-    public static int asBoundInt(final long value) {
-        if (value > Integer.MAX_VALUE) {
-            return Integer.MAX_VALUE;
-        } else if (value < Integer.MIN_VALUE) {
-            return Integer.MIN_VALUE;
-        }
-        return (int) value;
-    }
-
-    /**
-     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns the given
-     * {@code defaultValue}.
-     *
-     * @param timeValue
-     *            may be {@code null}
-     * @param defaultValue
-     *            may be {@code null}
-     * @return {@code timeValue} or {@code defaultValue}
-     */
-    public static TimeValue defaultsTo(final TimeValue timeValue, final TimeValue defaultValue) {
-        return timeValue != null ? timeValue : defaultValue;
-    }
-
-    /**
-     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
-     * {@link #NEG_ONE_SECONDS}.
-     *
-     * @param timeValue
-     *            may be {@code null}
-     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
-     */
-    public static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue) {
-        return defaultsTo(timeValue, NEG_ONE_MILLISECONDS);
-    }
-
-    /**
-     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
-     * {@link #NEG_ONE_SECONDS}.
-     *
-     * @param timeValue
-     *            may be {@code null}
-     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
-     */
-    public static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue) {
-        return defaultsTo(timeValue, NEG_ONE_SECONDS);
-    }
-
-    /**
-     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
-     * {@link #ZERO_MILLISECONDS}.
-     *
-     * @param timeValue
-     *            may be {@code null}
-     * @return {@code timeValue} or {@link #ZERO_MILLISECONDS}
-     */
-    public static TimeValue defaultsToZeroMillis(final TimeValue timeValue) {
-        return defaultsTo(timeValue, ZERO_MILLISECONDS);
-    }
-
-    public static boolean isNonNegative(final TimeValue timeValue) {
-        return timeValue != null && timeValue.getDuration() >= 0;
-    }
-
-    public static boolean isPositive(final TimeValue timeValue) {
-        return timeValue != null && timeValue.getDuration() > 0;
-    }
-
-    /**
-     * Creates a TimeValue.
-     *
-     * @param duration
-     *            the time duration in the given {@code timeUnit}.
-     * @param timeUnit
-     *            the time unit for the given durarion.
-     * @return a Timeout
-     */
-    public static TimeValue of(final long duration, final TimeUnit timeUnit) {
-        return new TimeValue(duration, timeUnit);
-    }
-
-    public static TimeValue ofDays(final long days) {
-        return of(days, TimeUnit.DAYS);
-    }
-
-    public static TimeValue ofHours(final long hours) {
-        return of(hours, TimeUnit.HOURS);
-    }
-
-    public static TimeValue ofMicroseconds(final long microseconds) {
-        return of(microseconds, TimeUnit.MICROSECONDS);
-    }
-
-    public static TimeValue ofMillis(final long millis) {
-        return of(millis, TimeUnit.MILLISECONDS);
-    }
-
-    public static TimeValue ofMinutes(final long minutes) {
-        return of(minutes, TimeUnit.MINUTES);
-    }
-
-    public static TimeValue ofNanoseconds(final long nanoseconds) {
-        return of(nanoseconds, TimeUnit.NANOSECONDS);
-    }
-
-    public static TimeValue ofSeconds(final long seconds) {
-        return of(seconds, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Parses a TimeValue in the format {@code <Integer><SPACE><TimeUnit>}, for example {@code "1,200 MILLISECONDS"}
-     *
-     * @param value
-     *            the TimeValue to parse
-     * @return a new TimeValue
-     * @throws ParseException
-     *             if the number cannot be parsed
-     */
-    public static TimeValue parse(final String value) throws ParseException {
-        final String split[] = value.split("\\s+");
-        if (split.length < 2) {
-            throw new IllegalArgumentException(
-                    String.format("Expected format for <Integer><SPACE><TimeUnit>: ", value));
-        }
-        return TimeValue.of(NumberFormat.getInstance().parse(split[0]).longValue(),
-                TimeUnit.valueOf(split[1].trim().toUpperCase(Locale.ROOT)));
-    }
-
-    private final long duration;
-
-    private final TimeUnit timeUnit;
-
-    TimeValue(final long duration, final TimeUnit timeUnit) {
-        super();
-        this.duration = duration;
-        this.timeUnit = Args.notNull(timeUnit, "timeUnit");
-    }
-
-    public long convert(final TimeUnit sourceUnit) {
-        return timeUnit.convert(duration, sourceUnit);
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof TimeValue) {
-            final TimeValue that = (TimeValue) obj;
-            return this.duration == that.duration && LangUtils.equals(this.timeUnit, that.timeUnit);
-        }
-        return false;
-    }
-
-    public long getDuration() {
-        return duration;
-    }
-
-    public TimeUnit getTimeUnit() {
-        return timeUnit;
-    }
-
-    @Override
-    public int hashCode() {
-        int hash = LangUtils.HASH_SEED;
-        hash = LangUtils.hashCode(hash, Long.valueOf(duration));
-        hash = LangUtils.hashCode(hash, timeUnit);
-        return hash;
-    }
-
-    public void sleep() throws InterruptedException {
-        timeUnit.sleep(duration);
-    }
-
-    public void timedJoin(final Thread thread) throws InterruptedException {
-        timeUnit.timedJoin(thread, duration);
-    }
-
-    public void timedWait(final Object obj) throws InterruptedException {
-        timeUnit.timedWait(obj, duration);
-    }
-
-    public long toDays() {
-        return timeUnit.toDays(duration);
-    }
-
-    public long toHours() {
-        return timeUnit.toHours(duration);
-    }
-
-    public long toMicros() {
-        return timeUnit.toMicros(duration);
-    }
-
-    public long toMillis() {
-        return timeUnit.toMillis(duration);
-    }
-
-    public int toMillisIntBound() {
-        return asBoundInt(toMillis());
-    }
-
-    public long toMinutes() {
-        return timeUnit.toMinutes(duration);
-    }
-
-    public long toNanos() {
-        return timeUnit.toNanos(duration);
-    }
-
-    public long toSeconds() {
-        return timeUnit.toSeconds(duration);
-    }
-
-    public int toSecondsIntBound() {
-        return asBoundInt(toSeconds());
-    }
-
-    @Override
-    public String toString() {
-        return String.format("%,d %s", Long.valueOf(duration), timeUnit);
-    }
-
-    public Timeout toTimeout() {
-        return Timeout.of(duration, timeUnit);
-    }
-
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.util;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+
+/**
+ * Represents a time value as a {@code long} time and {@link TimeUnit}.
+ *
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class TimeValue {
+
+    static final int INT_UNDEFINED = -1;
+    public static final TimeValue NEG_ONE_MILLISECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.MILLISECONDS);
+    public static final TimeValue NEG_ONE_SECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.SECONDS);
+    public static final TimeValue ZERO_MILLISECONDS = TimeValue.of(0, TimeUnit.MILLISECONDS);
+
+    /**
+     * Returns the given {@code long} value as an {@code int} where long values out of int range are returned as
+     * {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
+     *
+     * <p>
+     * For example: {@code TimeValue.asBoundInt(Long.MAX_VALUE)} returns {@code Integer.MAX_VALUE}.
+     * </p>
+     *
+     * @param value
+     *            a long value to convert
+     * @return an int value bound within {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}.
+     */
+    public static int asBoundInt(final long value) {
+        if (value > Integer.MAX_VALUE) {
+            return Integer.MAX_VALUE;
+        } else if (value < Integer.MIN_VALUE) {
+            return Integer.MIN_VALUE;
+        }
+        return (int) value;
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns the given
+     * {@code defaultValue}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @param defaultValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@code defaultValue}
+     */
+    public static TimeValue defaultsTo(final TimeValue timeValue, final TimeValue defaultValue) {
+        return timeValue != null ? timeValue : defaultValue;
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
+     * {@link #NEG_ONE_SECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+     */
+    public static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue) {
+        return defaultsTo(timeValue, NEG_ONE_MILLISECONDS);
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
+     * {@link #NEG_ONE_SECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+     */
+    public static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue) {
+        return defaultsTo(timeValue, NEG_ONE_SECONDS);
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
+     * {@link #ZERO_MILLISECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #ZERO_MILLISECONDS}
+     */
+    public static TimeValue defaultsToZeroMillis(final TimeValue timeValue) {
+        return defaultsTo(timeValue, ZERO_MILLISECONDS);
+    }
+
+    public static boolean isNonNegative(final TimeValue timeValue) {
+        return timeValue != null && timeValue.getDuration() >= 0;
+    }
+
+    public static boolean isPositive(final TimeValue timeValue) {
+        return timeValue != null && timeValue.getDuration() > 0;
+    }
+
+    /**
+     * Creates a TimeValue.
+     *
+     * @param duration
+     *            the time duration in the given {@code timeUnit}.
+     * @param timeUnit
+     *            the time unit for the given durarion.
+     * @return a Timeout
+     */
+    public static TimeValue of(final long duration, final TimeUnit timeUnit) {
+        return new TimeValue(duration, timeUnit);
+    }
+
+    public static TimeValue ofDays(final long days) {
+        return of(days, TimeUnit.DAYS);
+    }
+
+    public static TimeValue ofHours(final long hours) {
+        return of(hours, TimeUnit.HOURS);
+    }
+
+    public static TimeValue ofMicroseconds(final long microseconds) {
+        return of(microseconds, TimeUnit.MICROSECONDS);
+    }
+
+    public static TimeValue ofMillis(final long millis) {
+        return of(millis, TimeUnit.MILLISECONDS);
+    }
+
+    public static TimeValue ofMinutes(final long minutes) {
+        return of(minutes, TimeUnit.MINUTES);
+    }
+
+    public static TimeValue ofNanoseconds(final long nanoseconds) {
+        return of(nanoseconds, TimeUnit.NANOSECONDS);
+    }
+
+    public static TimeValue ofSeconds(final long seconds) {
+        return of(seconds, TimeUnit.SECONDS);
+    }
+
+    /**
+     * Parses a TimeValue in the format {@code <Integer><SPACE><TimeUnit>}, for example {@code "1,200 MILLISECONDS"}
+     *
+     * @param value
+     *            the TimeValue to parse
+     * @return a new TimeValue
+     * @throws ParseException
+     *             if the number cannot be parsed
+     */
+    public static TimeValue parse(final String value) throws ParseException {
+        final String split[] = value.split("\\s+");
+        if (split.length < 2) {
+            throw new IllegalArgumentException(
+                    String.format("Expected format for <Integer><SPACE><TimeUnit>: ", value));
+        }
+        return TimeValue.of(NumberFormat.getInstance().parse(split[0]).longValue(),
+                TimeUnit.valueOf(split[1].trim().toUpperCase(Locale.ROOT)));
+    }
+
+    private final long duration;
+
+    private final TimeUnit timeUnit;
+
+    TimeValue(final long duration, final TimeUnit timeUnit) {
+        super();
+        this.duration = duration;
+        this.timeUnit = Args.notNull(timeUnit, "timeUnit");
+    }
+
+    public long convert(final TimeUnit sourceUnit) {
+        return timeUnit.convert(duration, sourceUnit);
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof TimeValue) {
+            final TimeValue that = (TimeValue) obj;
+            return this.duration == that.duration && LangUtils.equals(this.timeUnit, that.timeUnit);
+        }
+        return false;
+    }
+
+    public long getDuration() {
+        return duration;
+    }
+
+    public TimeUnit getTimeUnit() {
+        return timeUnit;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = LangUtils.HASH_SEED;
+        hash = LangUtils.hashCode(hash, Long.valueOf(duration));
+        hash = LangUtils.hashCode(hash, timeUnit);
+        return hash;
+    }
+
+    public void sleep() throws InterruptedException {
+        timeUnit.sleep(duration);
+    }
+
+    public void timedJoin(final Thread thread) throws InterruptedException {
+        timeUnit.timedJoin(thread, duration);
+    }
+
+    public void timedWait(final Object obj) throws InterruptedException {
+        timeUnit.timedWait(obj, duration);
+    }
+
+    public long toDays() {
+        return timeUnit.toDays(duration);
+    }
+
+    public long toHours() {
+        return timeUnit.toHours(duration);
+    }
+
+    public long toMicros() {
+        return timeUnit.toMicros(duration);
+    }
+
+    public long toMillis() {
+        return timeUnit.toMillis(duration);
+    }
+
+    public int toMillisIntBound() {
+        return asBoundInt(toMillis());
+    }
+
+    public long toMinutes() {
+        return timeUnit.toMinutes(duration);
+    }
+
+    public long toNanos() {
+        return timeUnit.toNanos(duration);
+    }
+
+    public long toSeconds() {
+        return timeUnit.toSeconds(duration);
+    }
+
+    public int toSecondsIntBound() {
+        return asBoundInt(toSeconds());
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%,d %s", Long.valueOf(duration), timeUnit);
+    }
+
+    public Timeout toTimeout() {
+        return Timeout.of(duration, timeUnit);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java b/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java
index 04b40e0..888a25b 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/Timeout.java
@@ -1,211 +1,211 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.util;
-
-import java.text.ParseException;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-
-/**
- * Represents a timeout value as a {@code long} time and {@link TimeUnit}.
- *
- * @since 5.0
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class Timeout extends TimeValue {
-
-    public static final Timeout ZERO_MILLISECONDS = Timeout.of(0, TimeUnit.MILLISECONDS);
-
-    /**
-     * A disabled timeout represented as 0 {@code MILLISECONDS}.
-     */
-    public static final Timeout DISABLED = new Timeout(0, TimeUnit.MILLISECONDS);
-
-    /**
-     * An undefined timeout represented as -1 {@code MILLISECONDS}.
-     */
-    public static final Timeout UNDEFINED_MILLISECONDS = new Timeout(INT_UNDEFINED, TimeUnit.MILLISECONDS);
-
-    /**
-     * An undefined timeout represented as -1 {@code SECONDS}.
-     */
-    public static final Timeout UNDEFINED_SECONDS = new Timeout(INT_UNDEFINED, TimeUnit.SECONDS);
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param duration
-     *            the time duration in the given {@code timeUnit}.
-     * @param timeUnit
-     *            the time unit for the given durarion.
-     * @return a Timeout
-     */
-    public static Timeout of(final long duration, final TimeUnit timeUnit) {
-        return new Timeout(duration, timeUnit);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param days
-     *            the duration in days and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofDays(final long days) {
-        return of(days, TimeUnit.DAYS);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param hours
-     *            the duration in hours and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofHours(final long hours) {
-        return of(hours, TimeUnit.HOURS);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param microseconds
-     *            the duration in seconds and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofMicroseconds(final long microseconds) {
-        return of(microseconds, TimeUnit.MICROSECONDS);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param milliseconds
-     *            the duration in milliseconds and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofMillis(final long milliseconds) {
-        return of(milliseconds, TimeUnit.MILLISECONDS);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param minutes
-     *            the duration in minutes and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofMinutes(final long minutes) {
-        return of(minutes, TimeUnit.MINUTES);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param nanoseconds
-     *            the duration in seconds and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofNanoseconds(final long nanoseconds) {
-        return of(nanoseconds, TimeUnit.NANOSECONDS);
-    }
-
-    /**
-     * Creates a Timeout.
-     *
-     * @param seconds
-     *            the duration in seconds and the given {@code timeUnit}.
-     * @return a Timeout
-     */
-    public static Timeout ofSeconds(final long seconds) {
-        return of(seconds, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Parses a Timeout in the format {@code <Integer><SPACE><TimeUnit>}, for example {@code "1,200 MILLISECONDS"}
-     *
-     * @param value
-     *            the TimeValue to parse
-     * @return a new TimeValue
-     * @throws ParseException
-     *             if the number cannot be parsed
-     */
-    public static Timeout parse(final String value) throws ParseException {
-        return TimeValue.parse(value).toTimeout();
-    }
-
-    private static long validateDuration(final long duration) {
-        if (duration < INT_UNDEFINED) {
-            throw new IllegalArgumentException("Duration may not be less than " + INT_UNDEFINED);
-        }
-        return duration;
-    }
-
-    Timeout(final long duration, final TimeUnit timeUnit) {
-        super(validateDuration(duration), Args.notNull(timeUnit, "timeUnit"));
-    }
-
-    /**
-     * Whether this timeout is disabled.
-     *
-     * @return Whether this timeout is disabled.
-     */
-    public boolean isDisabled() {
-        return getDuration() == 0;
-    }
-
-    /**
-     * Whether this timeout is enabled.
-     *
-     * @return Whether this timeout is disabled.
-     */
-    public boolean isEnabled() {
-        return !isDisabled() && !(isUndefinedMilliseconds() || isUndefinedSeconds());
-    }
-
-    /**
-     * Whether this timeout is undefined.
-     *
-     * @return Whether this timeout is undefined.
-     */
-    public boolean isUndefinedMilliseconds() {
-        return getDuration() == INT_UNDEFINED && getTimeUnit() == TimeUnit.MILLISECONDS;
-    }
-
-    /**
-     * Whether this timeout is undefined.
-     *
-     * @return Whether this timeout is undefined.
-     */
-    public boolean isUndefinedSeconds() {
-        return getDuration() == INT_UNDEFINED && getTimeUnit() == TimeUnit.SECONDS;
-    }
-
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.util;
+
+import java.text.ParseException;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+
+/**
+ * Represents a timeout value as a {@code long} time and {@link TimeUnit}.
+ *
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class Timeout extends TimeValue {
+
+    public static final Timeout ZERO_MILLISECONDS = Timeout.of(0, TimeUnit.MILLISECONDS);
+
+    /**
+     * A disabled timeout represented as 0 {@code MILLISECONDS}.
+     */
+    public static final Timeout DISABLED = new Timeout(0, TimeUnit.MILLISECONDS);
+
+    /**
+     * An undefined timeout represented as -1 {@code MILLISECONDS}.
+     */
+    public static final Timeout UNDEFINED_MILLISECONDS = new Timeout(INT_UNDEFINED, TimeUnit.MILLISECONDS);
+
+    /**
+     * An undefined timeout represented as -1 {@code SECONDS}.
+     */
+    public static final Timeout UNDEFINED_SECONDS = new Timeout(INT_UNDEFINED, TimeUnit.SECONDS);
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param duration
+     *            the time duration in the given {@code timeUnit}.
+     * @param timeUnit
+     *            the time unit for the given durarion.
+     * @return a Timeout
+     */
+    public static Timeout of(final long duration, final TimeUnit timeUnit) {
+        return new Timeout(duration, timeUnit);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param days
+     *            the duration in days and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofDays(final long days) {
+        return of(days, TimeUnit.DAYS);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param hours
+     *            the duration in hours and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofHours(final long hours) {
+        return of(hours, TimeUnit.HOURS);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param microseconds
+     *            the duration in seconds and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofMicroseconds(final long microseconds) {
+        return of(microseconds, TimeUnit.MICROSECONDS);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param milliseconds
+     *            the duration in milliseconds and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofMillis(final long milliseconds) {
+        return of(milliseconds, TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param minutes
+     *            the duration in minutes and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofMinutes(final long minutes) {
+        return of(minutes, TimeUnit.MINUTES);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param nanoseconds
+     *            the duration in seconds and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofNanoseconds(final long nanoseconds) {
+        return of(nanoseconds, TimeUnit.NANOSECONDS);
+    }
+
+    /**
+     * Creates a Timeout.
+     *
+     * @param seconds
+     *            the duration in seconds and the given {@code timeUnit}.
+     * @return a Timeout
+     */
+    public static Timeout ofSeconds(final long seconds) {
+        return of(seconds, TimeUnit.SECONDS);
+    }
+
+    /**
+     * Parses a Timeout in the format {@code <Integer><SPACE><TimeUnit>}, for example {@code "1,200 MILLISECONDS"}
+     *
+     * @param value
+     *            the TimeValue to parse
+     * @return a new TimeValue
+     * @throws ParseException
+     *             if the number cannot be parsed
+     */
+    public static Timeout parse(final String value) throws ParseException {
+        return TimeValue.parse(value).toTimeout();
+    }
+
+    private static long validateDuration(final long duration) {
+        if (duration < INT_UNDEFINED) {
+            throw new IllegalArgumentException("Duration may not be less than " + INT_UNDEFINED);
+        }
+        return duration;
+    }
+
+    Timeout(final long duration, final TimeUnit timeUnit) {
+        super(validateDuration(duration), Args.notNull(timeUnit, "timeUnit"));
+    }
+
+    /**
+     * Whether this timeout is disabled.
+     *
+     * @return Whether this timeout is disabled.
+     */
+    public boolean isDisabled() {
+        return getDuration() == 0;
+    }
+
+    /**
+     * Whether this timeout is enabled.
+     *
+     * @return Whether this timeout is disabled.
+     */
+    public boolean isEnabled() {
+        return !isDisabled() && !(isUndefinedMilliseconds() || isUndefinedSeconds());
+    }
+
+    /**
+     * Whether this timeout is undefined.
+     *
+     * @return Whether this timeout is undefined.
+     */
+    public boolean isUndefinedMilliseconds() {
+        return getDuration() == INT_UNDEFINED && getTimeUnit() == TimeUnit.MILLISECONDS;
+    }
+
+    /**
+     * Whether this timeout is undefined.
+     *
+     * @return Whether this timeout is undefined.
+     */
+    public boolean isUndefinedSeconds() {
+        return getDuration() == INT_UNDEFINED && getTimeUnit() == TimeUnit.SECONDS;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d7768b2c/httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerExchangeHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerExchangeHandlerRegistry.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerExchangeHandlerRegistry.java
index 7a35684..fae4844 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerExchangeHandlerRegistry.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/bootstrap/TestAsyncServerExchangeHandlerRegistry.java
@@ -1,73 +1,73 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.http.impl.bootstrap;
-
-import org.apache.hc.core5.function.Supplier;
-import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.message.BasicHttpRequest;
-import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
-import org.apache.hc.core5.http.nio.support.ImmediateResponseExchangeHandler;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestAsyncServerExchangeHandlerRegistry {
-    private AsyncServerExchangeHandlerRegistry handlerRegistry;
-    private AsyncServerExchangeHandler handler;
-    private Supplier<AsyncServerExchangeHandler> supplier;
-
-    @Before
-    public void setUp() {
-        handlerRegistry = new AsyncServerExchangeHandlerRegistry("localhost");
-        handler = new ImmediateResponseExchangeHandler(HttpStatus.SC_OK, "Hello world");
-        supplier = new Supplier<AsyncServerExchangeHandler>() {
-
-            @Override
-            public AsyncServerExchangeHandler get() {
-                return handler;
-            }
-        };
-    }
-
-    @Test
-    public void testCreate() throws Exception {
-        handlerRegistry.register(null, "/test*", supplier);
-        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/")));
-        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/abc")));
-        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/test")));
-        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/testabc")));
-    }
-
-    @Test
-    public void testCreateQuery() throws Exception {
-        handlerRegistry.register(null, "/test*", supplier);
-        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/test?test=a")));
-        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/tes?test=a")));
-    }
-
-}
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http.impl.bootstrap;
+
+import org.apache.hc.core5.function.Supplier;
+import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.core5.http.message.BasicHttpRequest;
+import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
+import org.apache.hc.core5.http.nio.support.ImmediateResponseExchangeHandler;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestAsyncServerExchangeHandlerRegistry {
+    private AsyncServerExchangeHandlerRegistry handlerRegistry;
+    private AsyncServerExchangeHandler handler;
+    private Supplier<AsyncServerExchangeHandler> supplier;
+
+    @Before
+    public void setUp() {
+        handlerRegistry = new AsyncServerExchangeHandlerRegistry("localhost");
+        handler = new ImmediateResponseExchangeHandler(HttpStatus.SC_OK, "Hello world");
+        supplier = new Supplier<AsyncServerExchangeHandler>() {
+
+            @Override
+            public AsyncServerExchangeHandler get() {
+                return handler;
+            }
+        };
+    }
+
+    @Test
+    public void testCreate() throws Exception {
+        handlerRegistry.register(null, "/test*", supplier);
+        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/")));
+        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/abc")));
+        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/test")));
+        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/testabc")));
+    }
+
+    @Test
+    public void testCreateQuery() throws Exception {
+        handlerRegistry.register(null, "/test*", supplier);
+        Assert.assertEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/test?test=a")));
+        Assert.assertNotEquals(handler, handlerRegistry.create(new BasicHttpRequest("GET", "/tes?test=a")));
+    }
+
+}


Mime
View raw message