• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20481

14 Sep 2026 07:02PM UTC coverage: 88.708% (+0.03%) from 88.676%
#20481

push

github

web-flow
core: Gracefully handle GOAWAY frames with unrecognized error codes (v1.80.x backport) (#13047)

Backport of #13035 to v1.80.x.

35469 of 39984 relevant lines covered (88.71%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/../core/src/main/java/io/grpc/internal/GoAwayDisconnectError.java
1
/*
2
 * Copyright 2025 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.internal;
18

19

20
import javax.annotation.concurrent.Immutable;
21

22
/**
23
 * Represents a dynamic disconnection due to an HTTP/2 GOAWAY frame.
24
 * This class is immutable and holds the specific error code from the frame.
25
 */
26
@Immutable
27
public final class GoAwayDisconnectError implements DisconnectError {
28
  private static final String ERROR_TAG = "GOAWAY";
29
  private final GrpcUtil.Http2Error errorCode;
30

31
  /**
32
   * Creates a GoAway reason.
33
   *
34
   * @param errorCode The specific HTTP/2 error code (e.g., "NO_ERROR").
35
   */
36
  public GoAwayDisconnectError(GrpcUtil.Http2Error errorCode) {
1✔
37
    this.errorCode = errorCode != null ? errorCode : GrpcUtil.Http2Error.INTERNAL_ERROR;
1✔
38
  }
1✔
39

40
  @Override
41
  public String toErrorString() {
42
    return ERROR_TAG + " " + errorCode.name();
1✔
43
  }
44

45
  @Override
46
  public boolean equals(Object o) {
47
    if (this == o) {
1✔
48
      return true;
×
49
    }
50
    if (o == null || getClass() != o.getClass()) {
1✔
51
      return false;
×
52
    }
53
    GoAwayDisconnectError goAwayDisconnectError = (GoAwayDisconnectError) o;
1✔
54
    return errorCode == goAwayDisconnectError.errorCode;
1✔
55
  }
56

57
  @Override
58
  public int hashCode() {
59
    return errorCode.hashCode();
1✔
60
  }
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc