Just do not tell my you are westminster university student or I will start rolling on the floor laughing.
Anyway back to topic. I bet my salary that as server your teacher/tutor meant some J2EE server or web container such as Tomcat, JBoss etc that is able to run servlet which is supposed to received data from your mobile application, process it and return something back to your mobile apps. For this reason, the application must be server based where your server application as provided above is actually stand-alone desktop application with zero outside world communication.
You correctly understood that midlet is supposed to output data as stream and server need to read the stream and process it. On top of that similar process will happen from server side, server will produce stream with reply, midlet will receive it handle it appropriately. You can see example of midlet sending data here . You may also find more detailed explanation in books like J2ME in a Nutshell and Learning Wireless Java Help for New J2ME Developers (which are little out of date, not many developers use socket on jme these days)