Socket desconecta automatico

Olá,

eu estava fazendo uma conexão de um Socket a um ServerSocket, mas depois da primeira mensagem que o Socket recebe ele se desconecta automaticamente.

Socket, ler messagens:

private void startRunnable() {
new Thread(new Runnable() {

    @Override
    public void run() {
        while (started) {
            try {
                Object[] i = checkInput();
                if ((boolean) i[1] == true) {
                    callEvent(ClientEvents.onReciveMessageFromServer,
                            new onClientReciveMessageFromServer(client, (String) i[0]));
                }else{
                    client.shutdownInput();
                    client.close();
                    callEvent(ClientEvents.onEndConnection, new onClientEndConnection());
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }
}).start();
loaded = true;}
Object[] checkInput() {
try {
    String i = readInput();
    if (i != null) {
        return new Object[] { i, true };
    }
} catch (Exception e) {
    return new Object[] { null, false };
}
return new Object[] { null, false };

}

private String readInput() throws Exception {
try {
DataInputStream dis = new DataInputStream(client.getInputStream());
int length = dis.readInt();
byte[] data = new byte[length];
dis.readFully(data);
String input = new String(data, “UTF-8”);
dis.close();
return input;
} catch (Exception e) {
return null;
}
}

ServerSocket, aceitar os Sockets:

void startRunnables() throws Exception {
new Thread(new Runnable() {

    @Override
    public void run() {
        while (started) {
            try {
                Socket socket = server.accept();
                new Thread(new ClientThread(socket, instance)).start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}).start();
this.loaded = true;
callEvent(ServerEvents.onServerLoad, new onServerLoad(server, port));

}

ServerSocket, Cliente Thread:

public void run() {

do {
    try {
        if (!server.connectedSockets.contains(socket)) {
            Object[] i = server.checkInput(socket);
            if (((boolean) i[1]) == true) {
                if ((server.passwordEnabled ? ((String) (i[0])).equals(server.password) : true)) {
                    ServerClient sc;
                    server.connectedClients
                            .add(sc = new ServerClient(socket, socket.getInetAddress().getHostAddress()));
                    server.connectedSockets.add(socket);
                    server.callEvent(ServerEvents.onServerClientConnect, new onServerClientConnect(sc));
                } else {
                    server.connectedSockets.add(socket);
                    server.callEvent(ServerEvents.onServerSocketConnect, new onServerSocketConnect(socket));
                }
            } else {
                server.kickSocket(socket);
            }
        }
        Object[] ci;
        if ((boolean) (ci = server.checkInput(socket))[1] == true) {
            if (server.connectedClients.contains(server.socketToClient(socket))) {
                ServerClient client;
                if ((client = server.socketToClient(socket)) != null) {
                    server.callEvent(ServerEvents.onServerReciveMessageFromClient,
                            new onServerReciveMessageFromClient(client, (String) ci[0]));
                }
            } else {
                server.callEvent(ServerEvents.onServerReciveMessageFromUnauthenticatedSocket,
                        new onServerReciveMessageFromUnauthenticatedSocket(socket, (String) ci[0]));
            }
        } else {
            if (server.connectedClients.contains(server.socketToClient(socket))) {
                ServerClient client;
                if ((client = server.socketToClient(socket)) != null) {
                    server.callEvent(ServerEvents.onServerClientLeave, new onServerClientLeave(client));
                    server.kickClient(client);
                }
            } else {
                server.callEvent(ServerEvents.onServerSocketLeave, new onServerSocketLeave(socket));
                server.kickSocket(socket);
            }
        }
    } catch (Exception e) {
        return;
    }
} while (server.connectedSockets.contains(socket));

}

Desculpe se eu fiz algo muito feio, mas é minha primeira vez ao mexer com Socket e ServerSocket

Se vc dá return dentro do método vc encerra ele.