Android Java TCP/IP server to service

I can not add TCP/IP Server to the service, when closing (minimizing) the application, the server does not accept data. How to make the data transmitted continuously?

public int onStartCommand(Intent intent, int flags, int startId) {     myServer = new Server();     myServer.start();       return Service.START_STICKY; } 

Server

 private class Server extends Thread {     private Socket clientSocket;      private  ServerSocket server;      private  BufferedReader in;      private  BufferedWriter out;      private String LOG_TAG;      @Override     public void run() {       while (true) {             try {                 server = new ServerSocket(9002);                 clientSocket = server.accept();                 try {                     try {                         in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));                         out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));                         String word = in.readLine();                         Log.d(LOG_TAG, "***" + word + "***");                         out.write(word);                         out.flush();                     } finally {                         System.out.println("run closed");                         clientSocket.close();                         in.close();                         out.close();                     }                 } finally {                     System.out.println("Server closed");                     server.close();                 }             } catch (IOException e) {                 System.err.println(e);             }         }     } }