 
         case .fullyQuiesced:
             return .init(result: .connectionError(underlyingError: NIOHTTP2Errors.IOOnClosedConnection(), type: .protocolError), effect: nil)
+
+        case .modifying:
+            preconditionFailure("Must not be left in modifying state")
         }
     }
 

        // immediately. If this leaves us with zero streams, the connection is fullyQuiesced. Otherwise, we are quiescing.
        switch self.state {
        case .prefaceSent(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            let newState = QuiescingPrefaceSentState(fromPrefaceSent: state, lastStreamID: lastStreamID)
            self.state = .quiescingPrefaceSent(newState)
            return result

        case .active(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            let newState = LocallyQuiescedState(fromActive: state, lastRemoteStreamID: lastStreamID)
            self.state = .locallyQuiesced(newState)
            self.closeIfNeeded(newState)
            return result

        case .locallyQuiesced(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            self.state = .locallyQuiesced(state)
            self.closeIfNeeded(state)
            return result

        case .remotelyQuiesced(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            let newState = BothQuiescingState(fromRemotelyQuiesced: state, lastRemoteStreamID: lastStreamID)
            self.state = .bothQuiescing(newState)
            self.closeIfNeeded(newState)
            return result

        case .bothQuiescing(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            self.state = .bothQuiescing(state)
            self.closeIfNeeded(state)
            return result

        case .quiescingPrefaceSent(var state):
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            self.state = .quiescingPrefaceSent(state)
            return result

        case .idle, .prefaceReceived, .quiescingPrefaceReceived:
            // We're waiting for the preface.
            return .init(result: .connectionError(underlyingError: NIOHTTP2Errors.MissingPreface(), type: .protocolError), effect: nil)

        case .fullyQuiesced(var state):
            // We allow duplicate GOAWAY here, so long as it ratchets downwards.
            let result = state.sendGoAwayFrame(lastStreamID: lastStreamID)
            self.state = .fullyQuiesced(state)
            return result
        }
    }



        case .fullyQuiesced:
            return .init(result: .connectionError(underlyingError: NIOHTTP2Errors.IOOnClosedConnection(), type: .protocolError), effect: nil)

        case .modifying:
            preconditionFailure("Must not be left in modifying state")
        }
    }

