public void closeChannels() {
        try {
            if (socketChannel != null) {
                socketChannel.close();
            }
            if (serverChannel != null) {
                serverChannel.close();
            }
        } catch (IOException e) {
            stdOut.printError(TAG + " Error while closing socket");
        }
    }