1 // Copyright 2017 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.net.impl; 6 7 import androidx.annotation.VisibleForTesting; 8 9 import org.chromium.net.NetError; 10 11 /** Used in {@link CronetBidirectionalStream}. Implements {@link NetworkExceptionImpl}. */ 12 @VisibleForTesting 13 public class BidirectionalStreamNetworkException extends NetworkExceptionImpl { BidirectionalStreamNetworkException( String message, int errorCode, int cronetInternalErrorCode)14 public BidirectionalStreamNetworkException( 15 String message, int errorCode, int cronetInternalErrorCode) { 16 super(message, errorCode, cronetInternalErrorCode); 17 } 18 19 @Override immediatelyRetryable()20 public boolean immediatelyRetryable() { 21 switch (mCronetInternalErrorCode) { 22 case NetError.ERR_HTTP2_PING_FAILED: 23 case NetError.ERR_QUIC_HANDSHAKE_FAILED: 24 assert mErrorCode == ERROR_OTHER; 25 return true; 26 default: 27 return super.immediatelyRetryable(); 28 } 29 } 30 } 31