Normally server handling looks something like this:
ServerSocket s;
Socket newSocket;
while (newSocket = s.accept()) {
new SocketHandlingThread(newSocket).start();
}
where the SocketHandlingThread() is a class you created to do whatever the server side of the socket conversation should be.
There are two basic ways to do what you're asking (which is to handle the sockets synchronously). The first is to simply join on the handler thread before moving back on to accept() again, like this
while (newSocket = s.accept()) {
SocketHandlingThread thread = new SocketHandlingThread(newSocket);
thread.start();
thread.join();
}
As pointed out in the comments below, you can avoid a join by just calling the thread's run method like so
thread.run();
in place of the start and join calls.
The other method is to take whatever code is in the SocketHandlingThread's run method and move it into the loop directly.