final ServerSocket socket = new ServerSocket(5000);
final Socket clientSocket = socket.accept();



can you not put this at the end so it will set the tray up first as I think the program blocks...