title: What is a GoAway Frame in Http2 and how is it linked to Redirects?
body: <p>I am aware of <a href="http://openjdk.java.net/jeps/110" rel="nofollow noreferrer">HTTP/2 Client provided by Java 9</a> and while trying out the incubator module with the following code: </p>
  
  <pre><code>// Request builder
  URI uri = new URI("http://www.stackoverflow.com/"); // using www.google.com gives me some payload with no exception
  HttpRequest request = HttpRequest.newBuilder().uri(uri).GET().build();
  
  // Client
  HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build();
  System.out.println(httpClient.version());
  
  // Response builder
  HttpResponse response = httpClient.send(request, HttpResponse.BodyHandler.asString());
  
  System.out.println("statusCode = " + response.statusCode()); // 200 for google.com
  </code></pre>
  
  <p>I received this as an output : </p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.io.IOException: /192.168.0.2:60726: GOAWAY received
    at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleGoAway(Http2Connection.java:613)
    at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.handleConnectionFrame(Http2Connection.java:531)
    at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.processFrame(Http2Connection.java:466)
    at jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoder.decode(FramesDecoder.java:114)
    at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:152)
    at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.asyncReceive(Http2Connection.java:425)
    at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.upperRead(AsyncSSLDelegate.java:557)
    at jdk.incubator.httpclient/jdk.incubator.http.internal.common.Queue.put(Queue.java:73)
    at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.asyncReceive(AsyncSSLDelegate.java:503)
    at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection.asyncRead(PlainHttpConnection.java:300)
    at jdk.incubator.httpclient/jdk.incubator.http.PlainHttpConnection$ReadEvent.handle(PlainHttpConnection.java:395)
    at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:438)
    at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:408)
  </code></pre>
  </blockquote>
  
  <p>Moving down the stack trace I could find <code>GOAWAY</code> listed as one of types of </p>
  
  <pre><code>jdk.incubator.http.internal.frame.Http2Frame
  </code></pre>
  
  <p>but then the internal class is not much documented to find exactly what does this type represent. I tried searching for the same on links from the JEPs as well, but couldn't find any.</p>
  
  <p><strong><em>Q.</em></strong> What is a GoAway Frame? When and how is it used?</p>
  
  <p><strong><em>Q.</em></strong> Why if I change my code to use a client without following redirects trying to GET "stackoverflow.com" I do not get the same exception?</p>
  
  <pre><code>HttpClient httpClient = HttpClient.newBuilder().build();
  </code></pre>