2114
2115 /*
2116 * If no application specified hostname, use the IP address.
2117 */
2118 if (originalHostname == null || originalHostname.length() == 0) {
2119 originalHostname = inetAddress.getHostAddress();
2120 }
2121
2122 return originalHostname;
2123 }
2124
2125 // ONLY used by HttpsClient to setup the URI specified hostname
2126 //
2127 // Please NOTE that this method MUST be called before calling to
2128 // SSLSocket.setSSLParameters(). Otherwise, the {@code host} parameter
2129 // may override SNIHostName in the customized server name indication.
2130 public synchronized void setHost(String host) {
2131 this.host = host;
2132 this.serverNames =
2133 Utilities.addToSNIServerNameList(this.serverNames, this.host);
2134 }
2135
2136 /**
2137 * Gets an input stream to read from the peer on the other side.
2138 * Data read from this stream was always integrity protected in
2139 * transit, and will usually have been confidentiality protected.
2140 */
2141 @Override
2142 public synchronized InputStream getInputStream() throws IOException {
2143 if (isClosed()) {
2144 throw new SocketException("Socket is closed");
2145 }
2146
2147 /*
2148 * Can't call isConnected() here, because the Handshakers
2149 * do some initialization before we actually connect.
2150 */
2151 if (connectionState == cs_START) {
2152 throw new SocketException("Socket is not connected");
2153 }
2154
|
2114
2115 /*
2116 * If no application specified hostname, use the IP address.
2117 */
2118 if (originalHostname == null || originalHostname.length() == 0) {
2119 originalHostname = inetAddress.getHostAddress();
2120 }
2121
2122 return originalHostname;
2123 }
2124
2125 // ONLY used by HttpsClient to setup the URI specified hostname
2126 //
2127 // Please NOTE that this method MUST be called before calling to
2128 // SSLSocket.setSSLParameters(). Otherwise, the {@code host} parameter
2129 // may override SNIHostName in the customized server name indication.
2130 public synchronized void setHost(String host) {
2131 this.host = host;
2132 this.serverNames =
2133 Utilities.addToSNIServerNameList(this.serverNames, this.host);
2134
2135 if (!roleIsServer && (handshaker != null) && !handshaker.started()) {
2136 handshaker.setSNIServerNames(serverNames);
2137 }
2138 }
2139
2140 /**
2141 * Gets an input stream to read from the peer on the other side.
2142 * Data read from this stream was always integrity protected in
2143 * transit, and will usually have been confidentiality protected.
2144 */
2145 @Override
2146 public synchronized InputStream getInputStream() throws IOException {
2147 if (isClosed()) {
2148 throw new SocketException("Socket is closed");
2149 }
2150
2151 /*
2152 * Can't call isConnected() here, because the Handshakers
2153 * do some initialization before we actually connect.
2154 */
2155 if (connectionState == cs_START) {
2156 throw new SocketException("Socket is not connected");
2157 }
2158
|