Initializing BufferedReader and DataOutputStream in infinite loop Is it a good practice to initialize the BufferedReader and DataOutputStream in infinite loop?

        ServerSocket welcomeSocket = new ServerSocket(8080);
        Socket connectionSocket = welcomeSocket.accept();

        while (true) {
            BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); //close it
            DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream()); //close it
            //... Do read/write stuff
        }


Connection establishes successfully and communication happens normally. Just want to know that whether it is a good practice or not? It is a Java code.

Thanks.
At the very least use a try-with-resources: 

while (true) {
    try(BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())),
            DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream())){
        //... Do read/write stuff
    }
}


Then when the loop body is done (by normal control flow or by exception) the streams will be closed normally.

However if you want a lot of clients connecting at a time and you want them all to be able to interact at the same time you will need to delve into the async IO in the java.nio.channels package.