You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/04 19:45:38 UTC

[3/3] httpcomponents-core git commit: No need to nest else clauses. Replace some if/else with a ternary return. Remove unnecessary semicolons. Remove unnecessary cast. Remove unnecessary @SuppressWarnings. Access static methods directly. Remove exception

No need to nest else clauses. Replace some if/else with a ternary
return. Remove unnecessary semicolons. Remove unnecessary cast. Remove
unnecessary @SuppressWarnings. Access static methods directly. Remove
exception not thrown from method signatures.


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

Branch: refs/heads/master
Commit: 27ee7a105b71b1b3a56412bedddca9bd17403b6e
Parents: f434e59
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 4 07:57:13 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Aug 4 21:45:07 2018 +0200

----------------------------------------------------------------------
 .../hc/core5/http2/H2ConnectionException.java   |  2 +-
 .../hc/core5/http2/H2CorruptFrameException.java |  2 +-
 .../java/org/apache/hc/core5/http2/H2Error.java |  2 +-
 .../hc/core5/http2/H2StreamResetException.java  |  2 +-
 .../hc/core5/http2/HttpVersionPolicy.java       |  2 +-
 .../apache/hc/core5/http2/config/H2Param.java   |  2 +-
 .../apache/hc/core5/http2/config/H2Setting.java |  2 +-
 .../hc/core5/http2/frame/FrameConsts.java       |  2 +-
 .../apache/hc/core5/http2/frame/FrameFlag.java  |  2 +-
 .../apache/hc/core5/http2/frame/FrameType.java  |  2 +-
 .../apache/hc/core5/http2/frame/RawFrame.java   |  6 +-
 .../apache/hc/core5/http2/hpack/FifoBuffer.java |  6 +-
 .../hc/core5/http2/hpack/FifoLinkedList.java    |  5 +-
 .../hc/core5/http2/hpack/HPackDecoder.java      | 30 ++++-----
 .../hc/core5/http2/hpack/HPackEncoder.java      | 31 +++++----
 .../hc/core5/http2/hpack/HPackException.java    |  2 +-
 .../core5/http2/hpack/InboundDynamicTable.java  |  8 +--
 .../core5/http2/hpack/OutboundDynamicTable.java |  8 +--
 .../hc/core5/http2/impl/Http2Processors.java    |  2 +-
 .../nio/AbstractHttp2StreamMultiplexer.java     |  3 +-
 .../impl/nio/ClientHttp2StreamMultiplexer.java  |  3 +-
 .../impl/nio/ServerHttpProtocolNegotiator.java  |  3 +-
 .../nio/bootstrap/CancellableExecution.java     |  5 +-
 .../DefaultAsyncPushConsumerFactory.java        |  6 +-
 .../hc/core5/http2/WritableByteChannelMock.java |  8 +--
 .../http2/frame/TestDefaultFrameFactory.java    |  2 +-
 .../hc/core5/http2/frame/TestFrameFlag.java     |  2 +-
 .../hc/core5/http2/frame/TestH2Settings.java    |  2 +-
 .../impl/nio/entity/TestSharedInputBuffer.java  |  3 +-
 .../testing/classic/ClassicTestServer.java      |  6 +-
 .../framework/ClassicTestClientAdapter.java     |  4 +-
 .../testing/framework/ClientPOJOAdapter.java    |  2 +-
 .../testing/framework/ClientTestingAdapter.java |  4 +-
 .../core5/testing/framework/FrameworkTest.java  | 10 +--
 .../testing/framework/TestingFramework.java     | 19 +++---
 .../TestingFrameworkRequestHandler.java         |  4 +-
 .../TestClassicTestClientTestingAdapter.java    | 36 +++++------
 .../framework/TestClientPOJOAdapter.java        |  4 +-
 .../testing/framework/TestFrameworkTest.java    |  8 +--
 .../testing/framework/TestTestingFramework.java | 67 ++++++++++----------
 .../http/examples/AsyncServerFilterExample.java | 45 +++++++------
 .../hc/core5/concurrent/ComplexCancellable.java |  5 +-
 .../org/apache/hc/core5/http/ContentType.java   |  2 +-
 .../hc/core5/http/config/NamedElementChain.java | 24 ++-----
 .../hc/core5/http/impl/HttpProcessors.java      |  2 +-
 .../http/impl/bootstrap/HttpRequester.java      |  3 +-
 .../hc/core5/http/impl/io/HttpService.java      | 23 ++++---
 .../hc/core5/http/impl/io/SocketHolder.java     | 24 +++----
 .../impl/nio/AbstractHttp1StreamDuplexer.java   | 19 +++---
 .../impl/nio/ClientHttp1StreamDuplexer.java     |  3 +-
 .../hc/core5/http/message/MessageSupport.java   |  7 +-
 .../support/AbstractAsyncServerAuthFilter.java  | 64 +++++++++----------
 ...ServerFilterChainExchangeHandlerFactory.java |  6 +-
 .../BasicAsyncServerExpectationDecorator.java   | 12 +---
 ...aultAsyncResponseExchangeHandlerFactory.java | 17 +++--
 .../nio/support/TerminalAsyncServerFilter.java  |  5 +-
 .../main/java/org/apache/hc/core5/net/Host.java |  6 +-
 .../org/apache/hc/core5/net/URIBuilder.java     |  7 +-
 .../org/apache/hc/core5/reactor/IOWorkers.java  |  8 +--
 .../hc/core5/reactor/InternalDataChannel.java   |  6 +-
 .../apache/hc/core5/ssl/ReflectionSupport.java  |  1 -
 .../hc/core5/http/WritableByteChannelMock.java  |  8 +--
 .../http/impl/io/TestBHttpConnectionBase.java   | 23 +++----
 .../http/impl/io/TestHttpRequestExecutor.java   | 13 ++--
 .../hc/core5/http/impl/io/TestHttpService.java  | 13 ++--
 .../http/impl/io/TestSessionInOutBuffers.java   |  9 +--
 .../impl/io/TimeoutByteArrayInputStream.java    |  8 +--
 .../http/impl/nio/TestSessionInOutBuffers.java  |  7 +-
 .../core5/http/message/TestBasicLineParser.java |  2 +-
 .../TestAbstractBinAsyncEntityConsumer.java     |  2 +-
 .../TestAbstractBinAsyncEntityProducer.java     |  2 +-
 .../TestAbstractCharAsyncEntityConsumer.java    |  2 +-
 .../TestAbstractCharAsyncEntityProducer.java    |  2 +-
 .../apache/hc/core5/pool/TestLaxConnPool.java   |  9 +--
 .../hc/core5/pool/TestStrictConnPool.java       | 11 ++--
 .../reactor/TestAbstractIOSessionPool.java      | 66 +++++++++----------
 .../hc/core5/ssl/TestSSLContextBuilder.java     |  9 +--
 77 files changed, 354 insertions(+), 440 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
index c77dae4..66e2c1c 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
@@ -51,4 +51,4 @@ public class H2ConnectionException extends IOException {
         return code;
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
index 2fb1c91..275a9cb 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
@@ -34,4 +34,4 @@ public class H2CorruptFrameException extends IOException {
         super(message);
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
index 130d5e2..6787c48 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
@@ -153,4 +153,4 @@ public enum H2Error {
         return MAP_BY_CODE.get(code);
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
index 3ee9101..7c497c2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
@@ -51,4 +51,4 @@ public class H2StreamResetException extends IOException {
         return code;
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
index 237c864..867c619 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
@@ -30,4 +30,4 @@ public enum HttpVersionPolicy {
 
     FORCE_HTTP_1, FORCE_HTTP_2, NEGOTIATE
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
index 668e9eb..cc7294b 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
@@ -66,4 +66,4 @@ public enum H2Param {
         return LOOKUP_TABLE[code - 1].name();
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
index a29242e..a57c8da 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
@@ -53,4 +53,4 @@ public final class H2Setting {
         final StringBuilder sb = new StringBuilder().append(param).append(": ").append(value);
         return sb.toString();
     }
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
index 71d2207..cd47ee2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
@@ -37,4 +37,4 @@ public final class FrameConsts {
     public final static int MIN_FRAME_SIZE = 16384;    // 2 ^ 14
     public final static int MAX_FRAME_SIZE = 16777215; // 2 ^ 24 - 1;
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
index 763aefb..eed6d9e 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
@@ -52,4 +52,4 @@ public enum FrameFlag {
         return value;
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
index 235d851..bc7f9d9 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
@@ -70,4 +70,4 @@ public enum FrameType {
         return LOOKUP_TABLE[value].name();
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
index 8cf9455..d043b8c 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
@@ -65,12 +65,10 @@ public final class RawFrame extends Frame<ByteBuffer> {
                 }
                 dup.limit(dup.limit() - padding);
                 return dup;
-            } else {
-                return payload.duplicate();
             }
-        } else {
-            return null;
+            return payload.duplicate();
         }
+        return null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoBuffer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoBuffer.java
index 0c0a183..73a03ec 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoBuffer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoBuffer.java
@@ -81,11 +81,7 @@ final class FifoBuffer {
     }
 
     public HPackHeader getFirst() {
-        if (head > 0) {
-            return array[head - 1];
-        } else {
-            return array[array.length - 1];
-        }
+        return array[head > 0 ? head - 1 : array.length - 1];
     }
 
     public HPackHeader getLast() {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoLinkedList.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoLinkedList.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoLinkedList.java
index 9813ac3..a9b3ee9 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoLinkedList.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/FifoLinkedList.java
@@ -101,10 +101,9 @@ final class FifoLinkedList {
             last.seqNum = 0;
             length--;
             return last;
-        } else {
-            master.seqNum = 0;
-            return null;
         }
+        master.seqNum = 0;
+        return null;
     }
 
     public void clear() {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
index 8fad602..bc460f4 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
@@ -96,23 +96,22 @@ public final class HPackDecoder {
         int value = readByte(src) & nbits;
         if (value < nbits) {
             return value;
-        } else {
-            int m = 0;
-            while (m < 32) {
-                final int b = readByte(src);
-                if ((b & 0x80) != 0) {
-                    value += (b & 0x7f) << m;
-                    m += 7;
-                } else {
-                    if (m == 28 && (b & 0xf8) != 0) {
-                        break;
-                    }
-                    value += b << m;
-                    return value;
+        }
+        int m = 0;
+        while (m < 32) {
+            final int b = readByte(src);
+            if ((b & 0x80) != 0) {
+                value += (b & 0x7f) << m;
+                m += 7;
+            } else {
+                if (m == 28 && (b & 0xf8) != 0) {
+                    break;
                 }
+                value += b << m;
+                return value;
             }
-            throw new HPackException(MAX_LIMIT_EXCEEDED);
         }
+        throw new HPackException(MAX_LIMIT_EXCEEDED);
     }
 
     static void decodePlainString(final ByteArrayBuffer buffer, final ByteBuffer src) throws HPackException {
@@ -287,9 +286,8 @@ public final class HPackDecoder {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
-            } else {
-                list.add(header);
             }
+            list.add(header);
         }
         return list;
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
index de5176d..8d46253 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
@@ -163,29 +163,28 @@ public final class HPackEncoder {
                 dst.ensureCapacity(len + 8);
                 encodeInt(dst, 7, len, 0x0);
                 for (int i = 0; i < len; i++) {
-                    dst.append((int) charSequence.charAt(off + i));
+                    dst.append(charSequence.charAt(off + i));
                 }
             }
             return len;
-        } else {
-            final CharBuffer in = CharBuffer.wrap(charSequence, off, len);
-            while (in.hasRemaining()) {
-                ensureCapacity((int) (in.remaining() * this.charsetEncoder.averageBytesPerChar()) + 8);
-                final CoderResult result = this.charsetEncoder.encode(in, this.tmpBuf, true);
-                if (result.isError()) {
-                    result.throwException();
-                }
-            }
-            ensureCapacity(8);
-            final CoderResult result = this.charsetEncoder.flush(this.tmpBuf);
+        }
+        final CharBuffer in = CharBuffer.wrap(charSequence, off, len);
+        while (in.hasRemaining()) {
+            ensureCapacity((int) (in.remaining() * this.charsetEncoder.averageBytesPerChar()) + 8);
+            final CoderResult result = this.charsetEncoder.encode(in, this.tmpBuf, true);
             if (result.isError()) {
                 result.throwException();
             }
-            this.tmpBuf.flip();
-            final int binaryLen = this.tmpBuf.remaining();
-            encodeString(dst, this.tmpBuf, huffman);
-            return binaryLen;
         }
+        ensureCapacity(8);
+        final CoderResult result = this.charsetEncoder.flush(this.tmpBuf);
+        if (result.isError()) {
+            result.throwException();
+        }
+        this.tmpBuf.flip();
+        final int binaryLen = this.tmpBuf.remaining();
+        encodeString(dst, this.tmpBuf, huffman);
+        return binaryLen;
     }
 
     int encodeString(final ByteArrayBuffer dst, final String s, final boolean huffman) throws CharacterCodingException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
index 55ca547..224d6d6 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
@@ -38,4 +38,4 @@ public class HPackException extends HttpException {
         super(message, cause);
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/InboundDynamicTable.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/InboundDynamicTable.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/InboundDynamicTable.java
index bd0f528..d04c9c5 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/InboundDynamicTable.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/InboundDynamicTable.java
@@ -82,11 +82,9 @@ final class InboundDynamicTable {
         if (index < 1 || index > length()) {
             throw new IndexOutOfBoundsException();
         }
-        if (index <= staticTable.length()) {
-            return staticTable.get(index);
-        } else {
-            return headers.get(index - staticTable.length() - 1);
-        }
+        return index <= staticTable.length()
+                        ? staticTable.get(index)
+                        : headers.get(index - staticTable.length() - 1);
     }
 
     public void add(final HPackHeader header) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/OutboundDynamicTable.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/OutboundDynamicTable.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/OutboundDynamicTable.java
index cc709e8..a1c2e6a 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/OutboundDynamicTable.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/OutboundDynamicTable.java
@@ -89,11 +89,9 @@ final class OutboundDynamicTable {
         if (index < 1 || index > length()) {
             throw new IndexOutOfBoundsException();
         }
-        if (index <= staticTable.length()) {
-            return staticTable.get(index);
-        } else {
-            return headers.get(index - staticTable.length() - 1);
-        }
+        return index <= staticTable.length()
+                        ? staticTable.get(index)
+                        : headers.get(index - staticTable.length() - 1);
     }
 
     public void add(final HPackHeader header) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
index 0f636b6..3468a7b 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
@@ -78,7 +78,7 @@ public final class Http2Processors {
                         new RequestUserAgent(!TextUtils.isBlank(agentInfo) ? agentInfo :
                                 VersionInfo.getSoftwareInfo(SOFTWARE, "org.apache.hc.core5", HttpProcessors.class)),
                         new RequestExpectContinue());
-    };
+    }
 
     public static HttpProcessor client(final String agentInfo) {
         return customClient(agentInfo).build();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
index 56808e8..51a87d7 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
@@ -363,9 +363,8 @@ abstract class AbstractHttp2StreamMultiplexer implements Identifiable, HttpConne
             payload.position(payload.position() + chunk);
             ioSession.setEvent(SelectionKey.OP_WRITE);
             return chunk;
-        } else {
-            return 0;
         }
+        return 0;
     }
 
     private void updateInputCapacity(

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
index 6a46b96..fcc1337 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
@@ -114,9 +114,8 @@ public class ClientHttp2StreamMultiplexer extends AbstractHttp2StreamMultiplexer
             return new ClientHttp2StreamHandler(channel, httpProcessor, connMetrics, exchangeHandler,
                     pushHandlerFactory != null ? pushHandlerFactory : this.pushHandlerFactory,
                     context);
-        } else {
-            throw new H2ConnectionException(H2Error.INTERNAL_ERROR, "Unexpected executable command");
         }
+        throw new H2ConnectionException(H2Error.INTERNAL_ERROR, "Unexpected executable command");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
index 87891bd..e097e00 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java
@@ -126,9 +126,8 @@ public class ServerHttpProtocolNegotiator implements HttpConnectionEventHandler
                     if (bytebuf.get() != PREFACE[i]) {
                         if (expectValidH2Preface) {
                             throw new HttpException("Unexpected HTTP/2 preface");
-                        } else {
-                            validH2Preface = false;
                         }
+                        validH2Preface = false;
                     }
                 }
                 if (validH2Preface) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
index e96a036..7257782 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import org.apache.hc.core5.concurrent.Cancellable;
 import org.apache.hc.core5.concurrent.CancellableDependency;
 
-final class CancellableExecution implements CancellableDependency, Cancellable {
+final class CancellableExecution implements CancellableDependency {
 
     private final AtomicBoolean cancelled;
     private final AtomicReference<Cancellable> dependencyRef;
@@ -66,9 +66,8 @@ final class CancellableExecution implements CancellableDependency, Cancellable {
                 dependency.cancel();
             }
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/support/DefaultAsyncPushConsumerFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/support/DefaultAsyncPushConsumerFactory.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/support/DefaultAsyncPushConsumerFactory.java
index 2e76c23..271040e 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/support/DefaultAsyncPushConsumerFactory.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/support/DefaultAsyncPushConsumerFactory.java
@@ -51,11 +51,7 @@ public final class DefaultAsyncPushConsumerFactory implements HandlerFactory<Asy
     public AsyncPushConsumer create(final HttpRequest request, final HttpContext context) throws HttpException {
         try {
             final Supplier<AsyncPushConsumer> supplier = mapper.resolve(request, context);
-            if (supplier != null) {
-                return supplier.get();
-            } else {
-                return null;
-            }
+            return supplier != null ? supplier.get() : null;
         } catch (final MisdirectedRequestException ex) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
index d4a45b8..54377f3 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
@@ -78,13 +78,11 @@ public class WritableByteChannelMock implements WritableByteChannel {
                 src.limit(limit);
                 this.capacityUsed += chunk;
                 return chunk;
-            } else {
-                return 0;
             }
-        } else {
-            this.buf.put(src);
-            return len;
+            return 0;
         }
+        this.buf.put(src);
+        return len;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java
index 4a7bd4b..05946bb 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java
@@ -99,4 +99,4 @@ public class TestDefaultFrameFactory {
         Assert.assertEquals("Oopsie", new String(tmp, StandardCharsets.US_ASCII));
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestFrameFlag.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestFrameFlag.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestFrameFlag.java
index 53912e1..1a52618 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestFrameFlag.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestFrameFlag.java
@@ -38,4 +38,4 @@ public class TestFrameFlag {
         Assert.assertEquals(0x01 | 0x08 | 0x20, flags);
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
index 6f73e08..5090b1a 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
@@ -55,4 +55,4 @@ public class TestH2Settings {
         Assert.assertEquals("INITIAL_WINDOW_SIZE: 1024", setting2.toString());
     }
 
-};
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/entity/TestSharedInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/entity/TestSharedInputBuffer.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/entity/TestSharedInputBuffer.java
index 158efdb..7c259c7 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/entity/TestSharedInputBuffer.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/entity/TestSharedInputBuffer.java
@@ -41,6 +41,7 @@ import org.apache.hc.core5.http.nio.entity.SharedInputBuffer;
 import org.apache.hc.core5.http.nio.CapacityChannel;
 import org.junit.Assert;
 import org.junit.Test;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
 public class TestSharedInputBuffer {
@@ -200,7 +201,7 @@ public class TestSharedInputBuffer {
 
         Assert.assertEquals(Boolean.TRUE, task1.get(5, TimeUnit.SECONDS));
         Assert.assertEquals("12345678901234567890123456789012345678901234567890", task2.get(5, TimeUnit.SECONDS));
-        Mockito.verify(capacityChannel, Mockito.atLeast(1)).update(Mockito.anyInt());
+        Mockito.verify(capacityChannel, Mockito.atLeast(1)).update(ArgumentMatchers.anyInt());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
index f194e08..75398a6 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestServer.java
@@ -88,18 +88,16 @@ public class ClassicTestServer {
         final HttpServer server = this.serverRef.get();
         if (server != null) {
             return server.getLocalPort();
-        } else {
-            throw new IllegalStateException("Server not running");
         }
+        throw new IllegalStateException("Server not running");
     }
 
     public InetAddress getInetAddress() {
         final HttpServer server = this.serverRef.get();
         if (server != null) {
             return server.getInetAddress();
-        } else {
-            throw new IllegalStateException("Server not running");
         }
+        throw new IllegalStateException("Server not running");
     }
 
     public void start(final HttpProcessor httpProcessor, final Decorator<HttpServerRequestHandler> handlerDecorator) throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
index e2cf0a7..660d46c 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
@@ -147,11 +147,11 @@ public class ClassicTestClientAdapter extends ClientPOJOAdapter {
             final String contentType = entity == null ? null : entity.getContentType();
 
             // prepare the returned information
-            final Map<String, Object> ret = new HashMap<String, Object>();
+            final Map<String, Object> ret = new HashMap<>();
             ret.put(STATUS, response.getCode());
 
             // convert the headers to a Map
-            final Map<String, Object> headerMap = new HashMap<String, Object>();
+            final Map<String, Object> headerMap = new HashMap<>();
             for (final Header header : response.getAllHeaders()) {
                 headerMap.put(header.getName(), header.getValue());
             }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientPOJOAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientPOJOAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientPOJOAdapter.java
index 1c17128..946ba6c 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientPOJOAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientPOJOAdapter.java
@@ -151,5 +151,5 @@ public abstract class ClientPOJOAdapter {
      */
     public Map<String, Object> modifyRequest(final Map<String, Object> request) {
         return request;
-    };
+    }
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
index 33ba080..ee2282e 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClientTestingAdapter.java
@@ -111,14 +111,14 @@ public class ClientTestingAdapter {
      */
     public boolean isRequestSupported(final Map<String, Object> request) {
         return (adapter == null) || adapter.checkRequestSupport(request) == null;
-    };
+    }
 
     /**
      * See the documentation for the same method in {@link ClientPOJOAdapter}.
      */
     public Map<String, Object> modifyRequest(final Map<String, Object> request) {
        return (adapter == null) ? request : adapter.modifyRequest(request);
-    };
+    }
 
     /**
      * Generally a test's response expectations should not need to be modified, but

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
index 6e61583..326a8f1 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
@@ -87,12 +87,12 @@ public class FrameworkTest {
      */
     public Map<String, Object> initRequest() throws TestingFrameworkException {
         // initialize to some helpful defaults
-        final Map<String, Object> ret = new HashMap<String, Object>();
+        final Map<String, Object> ret = new HashMap<>();
         ret.put(PATH, TestingFramework.DEFAULT_REQUEST_PATH);
         ret.put(BODY, TestingFramework.DEFAULT_REQUEST_BODY);
         ret.put(CONTENT_TYPE, TestingFramework.DEFAULT_REQUEST_CONTENT_TYPE);
-        ret.put(QUERY, new HashMap<String, String>(TestingFramework.DEFAULT_REQUEST_QUERY));
-        ret.put(HEADERS, new HashMap<String, String>(TestingFramework.DEFAULT_REQUEST_HEADERS));
+        ret.put(QUERY, new HashMap<>(TestingFramework.DEFAULT_REQUEST_QUERY));
+        ret.put(HEADERS, new HashMap<>(TestingFramework.DEFAULT_REQUEST_HEADERS));
         ret.put(PROTOCOL_VERSION, TestingFramework.DEFAULT_REQUEST_PROTOCOL_VERSION);
 
         // GET is the default method.
@@ -138,11 +138,11 @@ public class FrameworkTest {
             response.put(STATUS, 200);
         }
 
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
         // initialize to some helpful defaults
         responseExpectations.put(BODY, TestingFramework.DEFAULT_RESPONSE_BODY);
         responseExpectations.put(CONTENT_TYPE, TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE);
-        responseExpectations.put(HEADERS, new HashMap<String, String>(TestingFramework.DEFAULT_RESPONSE_HEADERS));
+        responseExpectations.put(HEADERS, new HashMap<>(TestingFramework.DEFAULT_RESPONSE_HEADERS));
 
         // Now override any defaults with what is requested.
         responseExpectations.putAll(response);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
index 371ea7d..36761d3 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
@@ -56,6 +56,7 @@ import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
 import org.apache.hc.core5.io.CloseMode;
 
 public class TestingFramework {
+
     /**
      * Use the ALL_METHODS list to conveniently cycle through all HTTP methods.
      */
@@ -120,17 +121,17 @@ public class TestingFramework {
     public static final Map<String, String> DEFAULT_RESPONSE_HEADERS;
 
     static {
-        final Map<String, String> request = new HashMap<String, String>();
+        final Map<String, String> request = new HashMap<>();
         request.put("p1", "this");
         request.put("p2", "that");
         DEFAULT_REQUEST_QUERY = Collections.unmodifiableMap(request);
 
-        Map<String, String> headers = new HashMap<String, String>();
+        Map<String, String> headers = new HashMap<>();
         headers.put("header1", "stuff");
         headers.put("header2", "more stuff");
         DEFAULT_REQUEST_HEADERS = Collections.unmodifiableMap(headers);
 
-        headers = new HashMap<String, String>();
+        headers = new HashMap<>();
         headers.put("header3", "header_three");
         headers.put("header4", "header_four");
         DEFAULT_RESPONSE_HEADERS = Collections.unmodifiableMap(headers);
@@ -138,7 +139,7 @@ public class TestingFramework {
 
     private ClientTestingAdapter adapter;
     private TestingFrameworkRequestHandler requestHandler = new TestingFrameworkRequestHandler();
-    private List<FrameworkTest> tests = new ArrayList<FrameworkTest>();
+    private List<FrameworkTest> tests = new ArrayList<>();
 
     private HttpServer server;
     private int port;
@@ -156,13 +157,13 @@ public class TestingFramework {
         for (final String method : ALL_METHODS) {
             final List<Integer> statusList = Arrays.asList(200, 201);
             for (final Integer status : statusList) {
-                final Map<String, Object> request = new HashMap<String, Object>();
+                final Map<String, Object> request = new HashMap<>();
                 request.put(METHOD, method);
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, status);
 
-                final Map<String, Object> test = new HashMap<String, Object>();
+                final Map<String, Object> test = new HashMap<>();
                 test.put(REQUEST, request);
                 test.put(RESPONSE, response);
 
@@ -372,7 +373,7 @@ public class TestingFramework {
         if (expectedHeaders == null) {
             return;
         }
-        for (final Map.Entry<String, String> expectedHeader : ((Map<String, String>) expectedHeaders).entrySet()) {
+        for (final Map.Entry<String, String> expectedHeader : expectedHeaders.entrySet()) {
             final String expectedHeaderName = expectedHeader.getKey();
             if (! actualHeaders.containsKey(expectedHeaderName)) {
                 throw new TestingFrameworkException("Expected header not found: name=" + expectedHeaderName);
@@ -402,7 +403,7 @@ public class TestingFramework {
      * Deletes all tests.
      */
     public void deleteTests() {
-        tests = new ArrayList<FrameworkTest>();
+        tests = new ArrayList<>();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
index 9b460f6..2ab78eb 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
@@ -138,7 +138,7 @@ public class TestingFrameworkRequestHandler implements HttpRequestHandler {
             if (expectedQuery != null) {
                 final URI uri = request.getUri();
                 final List<NameValuePair> actualParams = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8);
-                final Map<String, String> actualParamsMap = new HashMap<String, String>();
+                final Map<String, String> actualParamsMap = new HashMap<>();
                 for (final NameValuePair actualParam : actualParams) {
                     actualParamsMap.put(actualParam.getName(), actualParam.getValue());
                 }
@@ -162,7 +162,7 @@ public class TestingFrameworkRequestHandler implements HttpRequestHandler {
             @SuppressWarnings("unchecked")
             final Map<String, String> expectedHeaders = (Map<String, String>) requestExpectations.get(HEADERS);
             if (expectedHeaders != null) {
-                final Map<String, String> actualHeadersMap = new HashMap<String, String>();
+                final Map<String, String> actualHeadersMap = new HashMap<>();
                 final Header[] actualHeaders = request.getAllHeaders();
                 for (final Header header : actualHeaders) {
                     actualHeadersMap.put(header.getName(), header.getValue());

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
index 0a22886..2df7f0c 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
@@ -77,9 +77,9 @@ public class TestClassicTestClientTestingAdapter {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
         final String defaultURI = null;
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -96,7 +96,7 @@ public class TestClassicTestClientTestingAdapter {
         final String defaultURI = "";
         final Map<String, Object> request = null;
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -111,9 +111,9 @@ public class TestClassicTestClientTestingAdapter {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
         final String defaultURI = "";
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final TestingFrameworkRequestHandler requestHandler = null;
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -128,7 +128,7 @@ public class TestClassicTestClientTestingAdapter {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
         final String defaultURI = "";
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
         final Map<String, Object> responseExpectations = null;
 
@@ -145,9 +145,9 @@ public class TestClassicTestClientTestingAdapter {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
         final String defaultURI = "";
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -163,11 +163,11 @@ public class TestClassicTestClientTestingAdapter {
 
         final String defaultURI = "";
 
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         request.put(PATH, ECHO_PATH);
 
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -183,12 +183,12 @@ public class TestClassicTestClientTestingAdapter {
 
         final String defaultURI = "";
 
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         request.put(PATH, ECHO_PATH);
         request.put(METHOD, "JUNK");
 
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         try {
             adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -210,13 +210,13 @@ public class TestClassicTestClientTestingAdapter {
         final HttpHost target = new HttpHost("localhost", this.server.getPort());
 
         final String defaultURI = target.toString();
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         request.put(PATH, ECHO_PATH);
         request.put(METHOD, "POST");
         final String body = "mybody";
         request.put(BODY, body);
 
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
         final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
         final Map<String, Object> response = adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -255,9 +255,9 @@ public class TestClassicTestClientTestingAdapter {
         this.server.start();
         final HttpHost target = new HttpHost("localhost", this.server.getPort());
         final String defaultURI = target.toString();
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
 
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         request.put(PATH, CUSTOM_PATH);
 
         for (final String method : TestingFramework.ALL_METHODS) {
@@ -271,7 +271,7 @@ public class TestClassicTestClientTestingAdapter {
     public void modifyRequest() {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final Map<String, Object> returnedRequest = adapter.modifyRequest(request);
 
         Assert.assertSame("Same request was not returned as expected.", request, returnedRequest);
@@ -281,7 +281,7 @@ public class TestClassicTestClientTestingAdapter {
     public void modifyResponseExpectations() {
         final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
 
-        final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+        final Map<String, Object> responseExpectations = new HashMap<>();
         final Map<String, Object> returnedResponseExpectations = adapter.modifyResponseExpectations(null, responseExpectations);
 
         Assert.assertSame("Same response expectations were not returned as expected.", responseExpectations, returnedResponseExpectations);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
index 332d6ab..132e0ce 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
@@ -36,7 +36,7 @@ public class TestClientPOJOAdapter {
     @Test
     public void modifyRequest() throws Exception {
         final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         final Map<String, Object> request2 = adapter.modifyRequest(request);
 
         Assert.assertSame("request should have been returned", request, request2);
@@ -69,7 +69,7 @@ public class TestClientPOJOAdapter {
             @Override
             public String getClientName() {
                 return null;
-            };
+            }
         };
 
         try {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/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 7b36152..57db424 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
@@ -89,8 +89,8 @@ public class TestFrameworkTest {
 
     @Test
     public void changeStatus() throws Exception {
-        final Map<String, Object> testMap = new HashMap<String, Object>();
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> testMap = new HashMap<>();
+        final Map<String, Object> response = new HashMap<>();
         testMap.put(RESPONSE, response);
         response.put(STATUS, 201);
 
@@ -102,8 +102,8 @@ public class TestFrameworkTest {
 
     @Test
     public void changeMethod() throws Exception {
-        final Map<String, Object> testMap = new HashMap<String, Object>();
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> testMap = new HashMap<>();
+        final Map<String, Object> request = new HashMap<>();
         testMap.put(REQUEST, request);
         request.put(METHOD, "POST");
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
index fd720ee..c9b7980 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
@@ -52,6 +52,7 @@ import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.junit.Assert;
 import org.junit.Test;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
 public class TestTestingFramework {
@@ -123,13 +124,12 @@ public class TestTestingFramework {
         }
     }
 
-    @SuppressWarnings("unchecked")
     @Test
     public void goodAdapterWithConstructor() throws Exception {
         final ClientTestingAdapter adapter = Mockito.mock(ClientTestingAdapter.class);
 
         // Have isRequestSupported() return false so no test will run.
-        Mockito.when(adapter.isRequestSupported(Mockito.<String, Object>anyMap()))
+        Mockito.when(adapter.isRequestSupported(ArgumentMatchers.<String, Object>anyMap()))
                      .thenReturn(false);
 
         final TestingFramework framework = newWebServerTestingFramework(adapter);
@@ -140,10 +140,9 @@ public class TestTestingFramework {
         verifyCallMethodNeverCalled(adapter);
     }
 
-    @SuppressWarnings("unchecked")
     private void verifyCallMethodNeverCalled(final ClientTestingAdapter adapter) throws Exception {
-        Mockito.verify(adapter, Mockito.never()).execute(Mockito.anyString(), Mockito.<String, Object>anyMap(),
-                       Mockito.any(TestingFrameworkRequestHandler.class), Mockito.<String, Object>anyMap());
+        Mockito.verify(adapter, Mockito.never()).execute(ArgumentMatchers.anyString(), ArgumentMatchers.<String, Object>anyMap(),
+                       ArgumentMatchers.any(TestingFrameworkRequestHandler.class), ArgumentMatchers.<String, Object>anyMap());
     }
 
     private TestingFramework newFrameworkAndSetAdapter(final ClientTestingAdapter adapter)
@@ -196,7 +195,7 @@ public class TestTestingFramework {
                 Assert.assertEquals("The responseExpectations do not match the defaults",
                                     defaultResponseExpectations, responseExpectations);
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, responseExpectations.get(STATUS));
                 response.put(BODY, responseExpectations.get(BODY));
                 response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -247,7 +246,7 @@ public class TestTestingFramework {
                 Assert.assertEquals(200, responseExpectations.get(STATUS));
 
                 // return a different status than expected.
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, 201);
                 return response;
             }
@@ -267,7 +266,7 @@ public class TestTestingFramework {
 
     private Map<String, Object> alreadyCheckedResponse() {
         // return an indication that the response has already been checked.
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> response = new HashMap<>();
         response.put(STATUS, TestingFramework.ALREADY_CHECKED);
         response.put(BODY, TestingFramework.ALREADY_CHECKED);
         response.put(CONTENT_TYPE, TestingFramework.ALREADY_CHECKED);
@@ -308,7 +307,7 @@ public class TestTestingFramework {
 
                 Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_BODY, responseExpectations.get(BODY));
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, TestingFramework.ALREADY_CHECKED);
 
                 // return a different body than expected.
@@ -341,7 +340,7 @@ public class TestTestingFramework {
 
                 Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, TestingFramework.ALREADY_CHECKED);
                 response.put(HEADERS, TestingFramework.ALREADY_CHECKED);
 
@@ -372,7 +371,7 @@ public class TestTestingFramework {
         final Map<String, String> headersCopy = (Map<String, String>) TestingFramework.deepcopy(TestingFramework.DEFAULT_RESPONSE_HEADERS);
         Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_HEADERS, headersCopy);
 
-        final Map<String, Object> deepMap = new HashMap<String, Object>();
+        final Map<String, Object> deepMap = new HashMap<>();
         deepMap.put(HEADERS, TestingFramework.DEFAULT_RESPONSE_HEADERS);
 
         @SuppressWarnings("unchecked")
@@ -406,7 +405,7 @@ public class TestTestingFramework {
                 final String headerName = (String) headersCopy.keySet().toArray()[0];
                 headersCopy.remove(headerName);
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, TestingFramework.ALREADY_CHECKED);
                 response.put(BODY, TestingFramework.ALREADY_CHECKED);
 
@@ -447,7 +446,7 @@ public class TestTestingFramework {
                 final String headerName = (String) headersCopy.keySet().toArray()[0];
                 headersCopy.put(headerName, headersCopy.get(headerName) + "junk");
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, TestingFramework.ALREADY_CHECKED);
                 response.put(BODY, TestingFramework.ALREADY_CHECKED);
 
@@ -496,8 +495,8 @@ public class TestTestingFramework {
 
         final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
 
-        final Map<String, Object> test = new HashMap<String, Object>();
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
+        final Map<String, Object> request = new HashMap<>();
         test.put(REQUEST, request);
         request.put(NAME, "MyName");
 
@@ -531,8 +530,8 @@ public class TestTestingFramework {
 
         final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
 
-        final Map<String, Object> test = new HashMap<String, Object>();
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
+        final Map<String, Object> response = new HashMap<>();
         test.put(RESPONSE, response);
         response.put(STATUS, 201);
 
@@ -559,8 +558,8 @@ public class TestTestingFramework {
 
         final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
 
-        final Map<String, Object> test = new HashMap<String, Object>();
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
+        final Map<String, Object> response = new HashMap<>();
         test.put(RESPONSE, response);
         response.put(STATUS, 201);
 
@@ -828,7 +827,7 @@ public class TestTestingFramework {
 
                 // The next line is needed because we have to make a copy of the responseExpectations.
                 // It is an unmodifiable map.
-                final Map<String, Object> tempResponseExpectations = new HashMap<String, Object>(responseExpectations);
+                final Map<String, Object> tempResponseExpectations = new HashMap<>(responseExpectations);
                 tempResponseExpectations.put(STATUS, 201);
                 final Map<String, Object> response = super.execute(defaultURI, request, requestHandler, tempResponseExpectations);
                 Assert.assertEquals(200,  response.get(STATUS));
@@ -859,7 +858,7 @@ public class TestTestingFramework {
                 // make sure the modifyRequest method was called by seeing if the request was modified.
                 Assert.assertTrue("modifyRequest should have been called.", request.containsKey(UNLIKELY_ITEM));
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, responseExpectations.get(STATUS));
                 response.put(BODY, responseExpectations.get(BODY));
                 response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -901,7 +900,7 @@ public class TestTestingFramework {
                 // make sure the modifyRequest method was called by seeing if the request was modified.
                 Assert.assertTrue("modifyResponseExpectations should have been called.", responseExpectations.containsKey(UNLIKELY_ITEM));
 
-                final Map<String, Object> response = new HashMap<String, Object>();
+                final Map<String, Object> response = new HashMap<>();
                 response.put(STATUS, responseExpectations.get(STATUS));
                 response.put(BODY, responseExpectations.get(BODY));
                 response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -960,7 +959,7 @@ public class TestTestingFramework {
 
     @Test
     public void defaultTestsWithMockedAdapter() throws Exception {
-        final Set<String> calledMethodSet = new HashSet<String>();
+        final Set<String> calledMethodSet = new HashSet<>();
 
         final ClientTestingAdapter adapter = new ClientTestingAdapter() {
             @Override
@@ -1023,20 +1022,20 @@ public class TestTestingFramework {
 //                              ],
 //          )
 
-        final Map<String, Object> test = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
 
         // Add request.
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         test.put(REQUEST, request);
 
         request.put(PATH, "/stuff");
 
-        final Map<String, Object> queryMap = new HashMap<String, Object>();
+        final Map<String, Object> queryMap = new HashMap<>();
         request.put(QUERY, queryMap);
 
         queryMap.put("param", "something");
 
-        final Map<String, Object> requestHeadersMap = new HashMap<String, Object>();
+        final Map<String, Object> requestHeadersMap = new HashMap<>();
         request.put(HEADERS, requestHeadersMap);
 
         requestHeadersMap.put("header1", "stuff");
@@ -1046,12 +1045,12 @@ public class TestTestingFramework {
         request.put(BODY, "What is the meaning of life?");
 
         // Response
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> response = new HashMap<>();
         test.put(RESPONSE, response);
 
         response.put(STATUS, 201);
 
-        final Map<String, Object> responseHeadersMap = new HashMap<String, Object>();
+        final Map<String, Object> responseHeadersMap = new HashMap<>();
         response.put(HEADERS, responseHeadersMap);
 
         responseHeadersMap.put("header3", "header_stuff");
@@ -1092,10 +1091,10 @@ public class TestTestingFramework {
 //                              ],
 //          )
 
-        final Map<String, Object> test = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
 
         // Add request.
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         test.put(REQUEST, request);
 
         request.put(PATH, null);
@@ -1109,7 +1108,7 @@ public class TestTestingFramework {
         request.put(BODY, null);
 
         // Response
-        final Map<String, Object> response = new HashMap<String, Object>();
+        final Map<String, Object> response = new HashMap<>();
         test.put(RESPONSE, response);
 
         response.put(STATUS, null);
@@ -1150,10 +1149,10 @@ public class TestTestingFramework {
 
         final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
 
-        final Map<String, Object> test = new HashMap<String, Object>();
+        final Map<String, Object> test = new HashMap<>();
 
         // Add request.
-        final Map<String, Object> request = new HashMap<String, Object>();
+        final Map<String, Object> request = new HashMap<>();
         test.put(REQUEST, request);
 
         request.put(PATH, "/stuff?stuffParm=stuff&stuffParm2=stuff2");

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
index 6168b07..a23159f 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
@@ -126,30 +126,29 @@ public class AsyncServerFilterExample {
                                     new BasicHttpResponse(HttpStatus.SC_OK),
                                     new BasicAsyncEntityProducer("Welcome", ContentType.TEXT_PLAIN));
                             return null;
-                        } else {
-                            return chain.proceed(request, entityDetails, context, new AsyncFilterChain.ResponseTrigger() {
-
-                                @Override
-                                public void sendInformation(
-                                        final HttpResponse response) throws HttpException, IOException {
-                                    responseTrigger.sendInformation(response);
-                                }
-
-                                @Override
-                                public void submitResponse(
-                                        final HttpResponse response, final AsyncEntityProducer entityProducer) throws HttpException, IOException {
-                                    response.addHeader("X-Filter", "My-Filter");
-                                    responseTrigger.submitResponse(response, entityProducer);
-                                }
-
-                                @Override
-                                public void pushPromise(
-                                        final HttpRequest promise, final AsyncPushProducer responseProducer) throws HttpException, IOException {
-                                    responseTrigger.pushPromise(promise, responseProducer);
-                                }
-
-                            });
                         }
+                        return chain.proceed(request, entityDetails, context, new AsyncFilterChain.ResponseTrigger() {
+
+                            @Override
+                            public void sendInformation(
+                                    final HttpResponse response) throws HttpException, IOException {
+                                responseTrigger.sendInformation(response);
+                            }
+
+                            @Override
+                            public void submitResponse(
+                                    final HttpResponse response, final AsyncEntityProducer entityProducer) throws HttpException, IOException {
+                                response.addHeader("X-Filter", "My-Filter");
+                                responseTrigger.submitResponse(response, entityProducer);
+                            }
+
+                            @Override
+                            public void pushPromise(
+                                    final HttpRequest promise, final AsyncPushProducer responseProducer) throws HttpException, IOException {
+                                responseTrigger.pushPromise(promise, responseProducer);
+                            }
+
+                        });
                     }
 
                 })

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
index 83b61d0..d2930b9 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
@@ -37,7 +37,7 @@ import org.apache.hc.core5.util.Args;
  *
  * @since 5.0
  */
-public final class ComplexCancellable implements Cancellable, CancellableDependency {
+public final class ComplexCancellable implements CancellableDependency {
 
     private final AtomicReference<Cancellable> dependencyRef;
     private final AtomicBoolean cancelled;
@@ -70,9 +70,8 @@ public final class ComplexCancellable implements Cancellable, CancellableDepende
                 dependency.cancel();
             }
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
index 4e48d8d..c67e15a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
@@ -125,7 +125,7 @@ public final class ContentType implements Serializable {
             TEXT_HTML,
             TEXT_PLAIN,
             TEXT_XML };
-        final HashMap<String, ContentType> map = new HashMap<String, ContentType>();
+        final HashMap<String, ContentType> map = new HashMap<>();
         for (final ContentType contentType: contentTypes) {
             map.put(contentType.getMimeType(), contentType);
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/config/NamedElementChain.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/config/NamedElementChain.java b/httpcore5/src/main/java/org/apache/hc/core5/http/config/NamedElementChain.java
index 7759cbc..77f882a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/config/NamedElementChain.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/config/NamedElementChain.java
@@ -49,19 +49,11 @@ public class NamedElementChain<E> {
     }
 
     public Node getFirst() {
-        if (master.next != master) {
-            return master.next;
-        } else {
-            return null;
-        }
+        return master.next != master ? master.next : null;
     }
 
     public Node getLast() {
-        if (master.previous != master) {
-            return master.previous;
-        } else {
-            return null;
-        }
+        return master.previous != master ? master.previous : null;
     }
 
     public Node addFirst(final E value, final String name) {
@@ -187,19 +179,11 @@ public class NamedElementChain<E> {
         }
 
         public Node getPrevious() {
-            if (previous != master) {
-                return previous;
-            } else {
-                return null;
-            }
+            return previous != master ? previous : null;
         }
 
         public Node getNext() {
-            if (next != master) {
-                return next;
-            } else {
-                return null;
-            }
+            return next != master ? next: null;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/impl/HttpProcessors.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/HttpProcessors.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/HttpProcessors.java
index affbee1..803b679 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/HttpProcessors.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/HttpProcessors.java
@@ -77,7 +77,7 @@ public final class HttpProcessors {
                         new RequestUserAgent(!TextUtils.isBlank(agentInfo) ? agentInfo :
                                 VersionInfo.getSoftwareInfo(SOFTWARE, "org.apache.hc.core5", HttpProcessors.class)),
                         new RequestExpectContinue());
-    };
+    }
 
     public static HttpProcessor client(final String agentInfo) {
         return customClient(agentInfo).build();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
index 2f2334b..7be2e36 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
@@ -238,9 +238,8 @@ public class HttpRequester implements ConnPoolControl<HttpHost>, ModalCloseable
         sock.connect(targetAddress, socketConfig.getSoTimeout().toMillisIntBound());
         if (URIScheme.HTTPS.same(targetHost.getSchemeName())) {
             return sslSocketFactory.createSocket(sock, targetHost.getHostName(), targetAddress.getPort(), true);
-        } else {
-            return sock;
         }
+        return sock;
     }
 
     public ClassicHttpResponse execute(

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
index fe2715d..91a3955 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
@@ -241,20 +241,19 @@ public class HttpService {
         } catch (final HttpException ex) {
             if (responseSubmitted.get()) {
                 throw ex;
-            } else {
-                try (final ClassicHttpResponse errorResponse = new BasicClassicHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR)) {
-                    handleException(ex, errorResponse);
-                    errorResponse.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
-                    context.setAttribute(HttpCoreContext.HTTP_RESPONSE, errorResponse);
-                    this.processor.process(errorResponse, errorResponse.getEntity(), context);
+            }
+            try (final ClassicHttpResponse errorResponse = new BasicClassicHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR)) {
+                handleException(ex, errorResponse);
+                errorResponse.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
+                context.setAttribute(HttpCoreContext.HTTP_RESPONSE, errorResponse);
+                this.processor.process(errorResponse, errorResponse.getEntity(), context);
 
-                    conn.sendResponseHeader(errorResponse);
-                    if (streamListener != null) {
-                        streamListener.onResponseHead(conn, errorResponse);
-                    }
-                    conn.sendResponseEntity(errorResponse);
-                    conn.close();
+                conn.sendResponseHeader(errorResponse);
+                if (streamListener != null) {
+                    streamListener.onResponseHead(conn, errorResponse);
                 }
+                conn.sendResponseEntity(errorResponse);
+                conn.close();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SocketHolder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SocketHolder.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SocketHolder.java
index 879d791..4a8496f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SocketHolder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SocketHolder.java
@@ -61,14 +61,12 @@ public class SocketHolder {
         InputStream local = inputStreamRef.get();
         if (local != null) {
             return local;
-        } else {
-            local = getInputStream(socket);
-            if (inputStreamRef.compareAndSet(null, local)) {
-                return local;
-            } else {
-                return inputStreamRef.get();
-            }
         }
+        local = getInputStream(socket);
+        if (inputStreamRef.compareAndSet(null, local)) {
+            return local;
+        }
+        return inputStreamRef.get();
     }
 
     protected InputStream getInputStream(final Socket socket) throws IOException {
@@ -83,14 +81,12 @@ public class SocketHolder {
         OutputStream local = outputStreamRef.get();
         if (local != null) {
             return local;
-        } else {
-            local = getOutputStream(socket);
-            if (outputStreamRef.compareAndSet(null, local)) {
-                return local;
-            } else {
-                return outputStreamRef.get();
-            }
         }
+        local = getOutputStream(socket);
+        if (outputStreamRef.compareAndSet(null, local)) {
+            return local;
+        }
+        return outputStreamRef.get();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/27ee7a10/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index 21a1433..9ae7b5f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -276,13 +276,12 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
                         if (contentDecoder != null) {
                             incomingMessage = new Message<>(messageHead, contentDecoder);
                             break;
+                        }
+                        inputEnd();
+                        if (connState.compareTo(ConnectionState.ACTIVE) == 0) {
+                            ioSession.setEvent(SelectionKey.OP_READ);
                         } else {
-                            inputEnd();
-                            if (connState.compareTo(ConnectionState.ACTIVE) == 0) {
-                                ioSession.setEvent(SelectionKey.OP_READ);
-                            } else {
-                                break;
-                            }
+                            break;
                         }
                     }
                 } while (bytesRead > 0);
@@ -524,11 +523,9 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
             contentEncoder.complete(trailers);
             ioSession.setEvent(SelectionKey.OP_WRITE);
             outgoingMessage = null;
-            if (contentEncoder instanceof ChunkEncoder) {
-                return MessageDelineation.CHUNK_CODED;
-            } else {
-                return MessageDelineation.MESSAGE_HEAD;
-            }
+            return contentEncoder instanceof ChunkEncoder
+                            ? MessageDelineation.CHUNK_CODED
+                            : MessageDelineation.MESSAGE_HEAD;
         } finally {
             outputLock.unlock();
         }