net: remove an arbitrary timeout in TestUDPReadSizeError

Looking at the condition actually exercised by the test it seems
unnecessary: assuming that the Write succeeds (checked earlier in the
test), the Read must have a nonzero number of bytes available to read
immediately. (That is not the case in TestUDPZeroByteBuffer, from
which this test appears to have been derived.)

Fixes #50870

Change-Id: Ia6040a2d5dc320f0b86ec9d6f6b91dc72e8f3b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/382537
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/net/udpsock_test.go b/src/net/udpsock_test.go
index 6f82554..f8acf6a 100644
--- a/src/net/udpsock_test.go
+++ b/src/net/udpsock_test.go
@@ -415,19 +415,14 @@
 		if n != len(b1) {
 			t.Errorf("got %d; want %d", n, len(b1))
 		}
-		c1.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
 		b2 := make([]byte, len(b1)-1)
 		if genericRead {
 			n, err = c1.(Conn).Read(b2)
 		} else {
 			n, _, err = c1.ReadFrom(b2)
 		}
-		switch err {
-		case nil: // ReadFrom succeeds
-		default: // Read may timeout, it depends on the platform
-			if nerr, ok := err.(Error); (!ok || !nerr.Timeout()) && runtime.GOOS != "windows" { // Windows returns WSAEMSGSIZE
-				t.Fatal(err)
-			}
+		if err != nil && runtime.GOOS != "windows" { // Windows returns WSAEMSGSIZE
+			t.Fatal(err)
 		}
 		if n != len(b1)-1 {
 			t.Fatalf("got %d; want %d", n, len(b1)-1)