Return challenge field on subscription with Java (EventSub)

Thank you so much, today I’ve learned something new. The basic problem is that I didn’t know that Content-Length would be really important, I thought that it was like just a parity control, but I didn’t knew that there wasn’t a EOF for the InputStream. This was freezing the connection until the socket gets closed. Cause this, the code wasn’t sending an answer, as it was reading the JSON, but not stopping the reading, was waiting for an end. I used the Content-Length and 0 in case it’s not there to just read that amount of bytes, and I could make it send properly the challenge. Anyway I have to face two issues, the first one is an issue in Java, that causes connections to get stuck, in a way that I can’t make consecutives connections, so I’ll have to check what happens.

The second issue I’m facing is this one:

The challenge is send on the same way as you said, only I got the challenge as an String, I writted it in the output stream and I sent it. It gives me like the format of the challenge is bad.