Socket communication error

Hi, I'd like to ask for a little help. I have this program that handles basic voting,but it should be done client-server,i.e. the server offers questions and multiple clients connect to vote,the server stores the answers etc... I haven't even come to that point of storing etc.,cause I'm stuck here for a while. I do multiple sending and receiving of messages between the client and the server,e.g. server offers an initial menu to choose from 5 categories, the client chooses one,then I handle the choice using switch(),so I send the appropriate answer back. Since one of my answers is a multi-line menu, I should use a while((line = reader.readline()) != null) loop so I could get all the lines to present to the client, so that he could choose from the menu. And that's where the problem arises - I noticed that if I delete the while() loop and read only one line,everything is OK,I get the answer based on user's input. If I use the loop,the program gets stuck when the user inputs text,it doesn't do anything,doesn't even terminate or give me errors. So, my code is kind of big, I'm not so sure how to post it here,so I'll initially post the critical part only,an excerpt from the client-side code, assume that on the other side there is server-side handling using switch() and case. Here is the snippet. There's only one while() loop, so it won't be hard to spot it. Thanks a lot, regards

I'll post a runnable program here - on the client side you just declare the Socket variable and create an object in main, and here is a piece of code on the server side - I'll just post the function that goes in the first case, so please test just the first case and ignore the others, since it doesn't really make any difference. So I guess this code will compile,just comment out the method calls in cases 2-5 and work with the first. Thanks a lot, I'm going to try that thing you said, but I got stuck with some deprecated class,so I have to find the non-deprecated equivalent.