socket.setSoTimeout(1000); socket.connect(new InetSocketAddress(clientAddress, 113), 100);
socket.setSoTimeout(SO_TIMEOUT); socket.connect(new InetSocketAddress(clientAddress, 113), CONNECT_TIMEOUT);
    public IdentClient(Logger logger, String clientAddress, Integer clientPort,            Integer serverPort) {        Socket socket = null;        if ((logger != null) && (clientAddress != null) && (clientPort != null)                && (serverPort != null)) {            try {                // Compose the IDENT request                StringBuilder sb = new StringBuilder();                sb.append(clientPort).append(" , ").append(serverPort).append(                        "\r\n");                String request = sb.toString();                // Send the request to the remote server                socket = new Socket();                socket.setSoTimeout(1000);                socket.connect(new InetSocketAddress(clientAddress, 113), 100);                socket.getOutputStream().write(request.getBytes());                // Read the response                BufferedReader in = new BufferedReader(new InputStreamReader(                        socket.getInputStream()));                String response = in.readLine();                // Parse the response                if (response != null) {                    StringTokenizer st = new StringTokenizer(response, ":");                    if (st.countTokens() >= 3) {                        // Skip the first token                        st.nextToken();                        // Get the command                        String command = st.nextToken().trim();                        if (command.equalsIgnoreCase("USERID")                                && st.countTokens() >= 2) {                            // Get the host type                            this.hostType = st.nextToken().trim();                            // Get the remaining text as a user identifier                            this.userIdentifier = st.nextToken("").substring(1);                        }                    }                }            } catch (IOException ioe) {                logger.log(Level.FINE, "Unable to complete the IDENT request",                        ioe);            } finally {                try {                    // Always attempt to close the socket                    if (socket != null)                        socket.close();                } catch (IOException ioe) {                    logger.log(Level.FINE, "Unable to close the socket", ioe);                }                ;            }        }    }