jdk/src/share/classes/sun/net/NetworkClient.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 51 6fe31bc95bbc
child 5162 0dbedf4fdb8c
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 51
diff changeset
     2
 * Copyright 1994-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package sun.net;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.Socket;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.net.InetAddress;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.net.InetSocketAddress;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.net.UnknownHostException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.net.Proxy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * This is the base class for network clients.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author      Jonathan Payne
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public class NetworkClient {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    protected Proxy     proxy = Proxy.NO_PROXY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /** Socket for communicating with server. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    protected Socket    serverSocket = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /** Stream for printing to the server. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    public PrintStream  serverOutput;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    /** Buffered stream for reading replies from server. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public InputStream  serverInput;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    protected static int defaultSoTimeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    protected static int defaultConnectTimeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    protected int readTimeout = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    protected int connectTimeout = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /* Name of encoding to use for output */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    protected static String encoding;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        final int vals[] = {0, 0};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        final String encs[] = { null };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        AccessController.doPrivileged(
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
    67
                new PrivilegedAction<Void>() {
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
    68
                    public Void run() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                        vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 0).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                        vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 0).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                        encs[0] = System.getProperty("file.encoding", "ISO8859_1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        if (vals[0] == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            defaultSoTimeout = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            defaultSoTimeout = vals[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        if (vals[1] == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            defaultConnectTimeout = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            defaultConnectTimeout = vals[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        encoding = encs[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            if (!isASCIISuperset (encoding)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                encoding = "ISO8859_1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            encoding = "ISO8859_1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Test the named character encoding to verify that it converts ASCII
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * characters correctly. We have to use an ASCII based encoding, or else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * the NetworkClients will not work correctly in EBCDIC based systems.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * However, we cannot just use ASCII or ISO8859_1 universally, because in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Asian locales, non-ASCII characters may be embedded in otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * ASCII based protocols (eg. HTTP). The specifications (RFC2616, 2398)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * are a little ambiguous in this matter. For instance, RFC2398 [part 2.1]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * says that the HTTP request URI should be escaped using a defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * mechanism, but there is no way to specify in the escaped string what
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * the original character set is. It is not correct to assume that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * UTF-8 is always used (as in URLs in HTML 4.0).  For this reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * until the specifications are updated to deal with this issue more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * comprehensively, and more importantly, HTTP servers are known to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * support these mechanisms, we will maintain the current behavior
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * where it is possible to send non-ASCII characters in their original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * unescaped form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    private static boolean isASCIISuperset (String encoding) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        String chkS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                        "abcdefghijklmnopqrstuvwxyz-_.!~*'();/?:@&=+$,";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        // Expected byte sequence for string above
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        byte[] chkB = { 48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                115,116,117,118,119,120,121,122,45,95,46,33,126,42,39,40,41,59,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                47,63,58,64,38,61,43,36,44};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        byte[] b = chkS.getBytes (encoding);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        return Arrays.equals (b, chkB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /** Open a connection to the server. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public void openServer(String server, int port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        throws IOException, UnknownHostException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        if (serverSocket != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            closeServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        serverSocket = doConnect (server, port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            serverOutput = new PrintStream(new BufferedOutputStream(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                                        serverSocket.getOutputStream()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                        true, encoding);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        } catch (UnsupportedEncodingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            throw new InternalError(encoding +"encoding not found");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        serverInput = new BufferedInputStream(serverSocket.getInputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * Return a socket connected to the server, with any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * appropriate options pre-established
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    protected Socket doConnect (String server, int port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    throws IOException, UnknownHostException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        Socket s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        if (proxy != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            if (proxy.type() == Proxy.Type.SOCKS) {
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   155
                s = AccessController.doPrivileged(
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   156
                    new PrivilegedAction<Socket>() {
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   157
                        public Socket run() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                                       return new Socket(proxy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                                   }});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                s = new Socket(Proxy.NO_PROXY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            s = new Socket();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        // Instance specific timeouts do have priority, that means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        // connectTimeout & readTimeout (-1 means not set)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        // Then global default timeouts
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        // Then no timeout.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        if (connectTimeout >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            s.connect(new InetSocketAddress(server, port), connectTimeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            if (defaultConnectTimeout > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                s.connect(new InetSocketAddress(server, port), defaultConnectTimeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                s.connect(new InetSocketAddress(server, port));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        if (readTimeout >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            s.setSoTimeout(readTimeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        else if (defaultSoTimeout > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            s.setSoTimeout(defaultSoTimeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        return s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    protected InetAddress getLocalAddress() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        if (serverSocket == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            throw new IOException("not connected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        return serverSocket.getLocalAddress();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /** Close an open connection to the server. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    public void closeServer() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        if (! serverIsOpen()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        serverSocket.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        serverSocket = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        serverInput = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        serverOutput = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /** Return server connection status */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public boolean serverIsOpen() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        return serverSocket != null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    /** Create connection with host <i>host</i> on port <i>port</i> */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public NetworkClient(String host, int port) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        openServer(host, port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public NetworkClient() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public void setConnectTimeout(int timeout) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        connectTimeout = timeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public int getConnectTimeout() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        return connectTimeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    public void setReadTimeout(int timeout) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        if (serverSocket != null && timeout >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                serverSocket.setSoTimeout(timeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            } catch(IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                // We tried...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        readTimeout = timeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    public int getReadTimeout() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        return readTimeout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
}