in Sources/NIOSOCKS/State/ServerStateMachine.swift [165:185]
mutating func sendAuthenticationData(_ data: ByteBuffer, complete: Bool) throws {
switch self.state {
case .authenticating:
break
case .waitingForClientRequest:
guard self.authenticationMethod == .noneRequired, complete, data.readableBytes == 0 else {
throw SOCKSError.InvalidServerState()
}
case .inactive,
.waitingForClientGreeting,
.waitingToSendAuthenticationMethod,
.waitingToSendResponse,
.active,
.error:
throw SOCKSError.InvalidServerState()
}
if complete {
self.state = .waitingForClientRequest
}
}