Infinite loop with Selector even there's no connection from client
问题 I'm new with Java NIO, after reading some tutorials, I've tried my own to write a simple NIO server and client. My server just does a simple thing is listen from client and print to console, and the client just connects to server and send to it 3 messages "Hello". The problem is my server listens and works well with the 3 messages, after that it should be blocked and continue listening, but it does not, there's no blocking, it runs it while loop infinitely. Here's my server and client: Server