Fix exception handling when creating IO Dispatchers

When creating IO Dispatchers, there is possibility that an exception(fatal) can occur due to which dispatchers/worker threads creation fail and requests in queue aren't processed forever. See for example: https://issues.apache.org/jira/browse/HTTPCORE-758
So that if there are any exceptions while creating IO dispatchers, shutdown() will be called and all the components down the line are shutdown and cancel() will be called for future callbacks references, thus the caller won't wait indefinitely for the response from Apache Http client.
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
index 916e324..81dc921 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
@@ -316,6 +316,9 @@
             Asserts.check(this.status.compareTo(IOReactorStatus.INACTIVE) == 0,
                     "Illegal state %s", this.status);
             this.status = IOReactorStatus.ACTIVE;
+        }
+        try {
+
             // Start I/O dispatchers
             for (int i = 0; i < this.dispatchers.length; i++) {
                 final BaseIOReactor dispatcher = new BaseIOReactor(this.selectTimeout, this.interestOpsQueueing);
@@ -327,9 +330,6 @@
                 this.workers[i] = new Worker(dispatcher, eventDispatch);
                 this.threads[i] = this.threadFactory.newThread(this.workers[i]);
             }
-        }
-        try {
-
             for (int i = 0; i < this.workerCount; i++) {
                 if (this.status != IOReactorStatus.ACTIVE) {
                     return;
@@ -431,7 +431,9 @@
         // Attempt to shut down I/O dispatchers gracefully
         for (int i = 0; i < this.workerCount; i++) {
             final BaseIOReactor dispatcher = this.dispatchers[i];
-            dispatcher.gracefulShutdown();
+            if (dispatcher != null) {
+                dispatcher.gracefulShutdown();
+            }
         }
 
         final long gracePeriod = this.config.getShutdownGracePeriod();
@@ -441,6 +443,9 @@
             // in time
             for (int i = 0; i < this.workerCount; i++) {
                 final BaseIOReactor dispatcher = this.dispatchers[i];
+                if (dispatcher == null) {
+                    continue;
+                }
                 if (dispatcher.getStatus() != IOReactorStatus.INACTIVE) {
                     dispatcher.awaitShutdown(gracePeriod);
                 }