100 /** |
100 /** |
101 * Returns the unique {@link java.nio.SocketChannel SocketChannel} object |
101 * Returns the unique {@link java.nio.SocketChannel SocketChannel} object |
102 * associated with this socket, if any. |
102 * associated with this socket, if any. |
103 * @see java.net.Socket#getChannel |
103 * @see java.net.Socket#getChannel |
104 */ |
104 */ |
|
105 @Override |
105 public final SocketChannel getChannel() { |
106 public final SocketChannel getChannel() { |
106 if (self == this) { |
107 if (self == this) { |
107 return super.getChannel(); |
108 return super.getChannel(); |
108 } else { |
109 } else { |
109 return self.getChannel(); |
110 return self.getChannel(); |
162 * us. |
166 * us. |
163 * |
167 * |
164 * @param endpoint the <code>SocketAddress</code> |
168 * @param endpoint the <code>SocketAddress</code> |
165 * @throws IOException if an error occurs during the connection |
169 * @throws IOException if an error occurs during the connection |
166 */ |
170 */ |
|
171 @Override |
167 public final void connect(SocketAddress endpoint) throws IOException { |
172 public final void connect(SocketAddress endpoint) throws IOException { |
168 connect(endpoint, 0); |
173 connect(endpoint, 0); |
169 } |
174 } |
170 |
175 |
171 /** |
176 /** |
172 * Returns the connection state of the socket. |
177 * Returns the connection state of the socket. |
173 * @see java.net.Socket#isConnected |
178 * @see java.net.Socket#isConnected |
174 */ |
179 */ |
|
180 @Override |
175 public final boolean isConnected() { |
181 public final boolean isConnected() { |
176 if (self == this) { |
182 if (self == this) { |
177 return super.isConnected(); |
183 return super.isConnected(); |
178 } else { |
184 } else { |
179 return self.isConnected(); |
185 return self.isConnected(); |
201 * spec. Thus when the method is called on an SSL socket, an |
208 * spec. Thus when the method is called on an SSL socket, an |
202 * UnsupportedOperationException will be thrown. |
209 * UnsupportedOperationException will be thrown. |
203 * |
210 * |
204 * @throws UnsupportedOperationException |
211 * @throws UnsupportedOperationException |
205 */ |
212 */ |
|
213 @Override |
206 public final void shutdownInput() throws IOException { |
214 public final void shutdownInput() throws IOException { |
207 throw new UnsupportedOperationException("The method shutdownInput()" + |
215 throw new UnsupportedOperationException("The method shutdownInput()" + |
208 " is not supported in SSLSocket"); |
216 " is not supported in SSLSocket"); |
209 } |
217 } |
210 |
218 |
213 * spec. Thus when the method is called on an SSL socket, an |
221 * spec. Thus when the method is called on an SSL socket, an |
214 * UnsupportedOperationException will be thrown. |
222 * UnsupportedOperationException will be thrown. |
215 * |
223 * |
216 * @throws UnsupportedOperationException |
224 * @throws UnsupportedOperationException |
217 */ |
225 */ |
|
226 @Override |
218 public final void shutdownOutput() throws IOException { |
227 public final void shutdownOutput() throws IOException { |
219 throw new UnsupportedOperationException("The method shutdownOutput()" + |
228 throw new UnsupportedOperationException("The method shutdownOutput()" + |
220 " is not supported in SSLSocket"); |
229 " is not supported in SSLSocket"); |
221 |
230 |
222 } |
231 } |
223 |
232 |
224 /** |
233 /** |
225 * Returns the input state of the socket |
234 * Returns the input state of the socket |
226 * @see java.net.Socket#isInputShutdown |
235 * @see java.net.Socket#isInputShutdown |
227 */ |
236 */ |
|
237 @Override |
228 public final boolean isInputShutdown() { |
238 public final boolean isInputShutdown() { |
229 if (self == this) { |
239 if (self == this) { |
230 return super.isInputShutdown(); |
240 return super.isInputShutdown(); |
231 } else { |
241 } else { |
232 return self.isInputShutdown(); |
242 return self.isInputShutdown(); |
250 * as possible, in case the application forgets to do so. |
261 * as possible, in case the application forgets to do so. |
251 * This allows SSL connections to be implicitly reclaimed, |
262 * This allows SSL connections to be implicitly reclaimed, |
252 * rather than forcing them to be explicitly reclaimed at |
263 * rather than forcing them to be explicitly reclaimed at |
253 * the penalty of prematurly killing SSL sessions. |
264 * the penalty of prematurly killing SSL sessions. |
254 */ |
265 */ |
|
266 @Override |
255 protected final void finalize() throws Throwable { |
267 protected final void finalize() throws Throwable { |
256 try { |
268 try { |
257 close(); |
269 close(); |
258 } catch (IOException e1) { |
270 } catch (IOException e1) { |
259 try { |
271 try { |
346 * relates to low-level buffering of TCP traffic, delaying the |
363 * relates to low-level buffering of TCP traffic, delaying the |
347 * traffic to promote better throughput. |
364 * traffic to promote better throughput. |
348 * |
365 * |
349 * @see java.net.Socket#getTcpNoDelay |
366 * @see java.net.Socket#getTcpNoDelay |
350 */ |
367 */ |
|
368 @Override |
351 public final boolean getTcpNoDelay() throws SocketException { |
369 public final boolean getTcpNoDelay() throws SocketException { |
352 if (self == this) { |
370 if (self == this) { |
353 return super.getTcpNoDelay(); |
371 return super.getTcpNoDelay(); |
354 } else { |
372 } else { |
355 return self.getTcpNoDelay(); |
373 return self.getTcpNoDelay(); |
386 * @see java.net.Socket#sendUrgentData |
406 * @see java.net.Socket#sendUrgentData |
387 * At this point, there seems to be no specific requirement to support |
407 * At this point, there seems to be no specific requirement to support |
388 * this for an SSLSocket. An implementation can be provided if a need |
408 * this for an SSLSocket. An implementation can be provided if a need |
389 * arises in future. |
409 * arises in future. |
390 */ |
410 */ |
|
411 @Override |
391 public final void sendUrgentData(int data) throws SocketException { |
412 public final void sendUrgentData(int data) throws SocketException { |
392 throw new SocketException("This method is not supported " |
413 throw new SocketException("This method is not supported " |
393 + "by SSLSockets"); |
414 + "by SSLSockets"); |
394 } |
415 } |
395 |
416 |
399 * discarded. |
420 * discarded. |
400 * @see java.net.Socket#setOOBInline |
421 * @see java.net.Socket#setOOBInline |
401 * Setting OOBInline does not have any effect on SSLSocket, |
422 * Setting OOBInline does not have any effect on SSLSocket, |
402 * since currently we don't support sending urgent data. |
423 * since currently we don't support sending urgent data. |
403 */ |
424 */ |
|
425 @Override |
404 public final void setOOBInline(boolean on) throws SocketException { |
426 public final void setOOBInline(boolean on) throws SocketException { |
405 throw new SocketException("This method is ineffective, since" |
427 throw new SocketException("This method is ineffective, since" |
406 + " sending urgent data is not supported by SSLSockets"); |
428 + " sending urgent data is not supported by SSLSockets"); |
407 } |
429 } |
408 |
430 |
409 /** |
431 /** |
410 * Tests if OOBINLINE is enabled. |
432 * Tests if OOBINLINE is enabled. |
411 * @see java.net.Socket#getOOBInline |
433 * @see java.net.Socket#getOOBInline |
412 */ |
434 */ |
|
435 @Override |
413 public final boolean getOOBInline() throws SocketException { |
436 public final boolean getOOBInline() throws SocketException { |
414 throw new SocketException("This method is ineffective, since" |
437 throw new SocketException("This method is ineffective, since" |
415 + " sending urgent data is not supported by SSLSockets"); |
438 + " sending urgent data is not supported by SSLSockets"); |
416 } |
439 } |
417 |
440 |
418 /** |
441 /** |
419 * Returns the socket timeout. |
442 * Returns the socket timeout. |
420 * @see java.net.Socket#getSoTimeout |
443 * @see java.net.Socket#getSoTimeout |
421 */ |
444 */ |
|
445 @Override |
422 public final int getSoTimeout() throws SocketException { |
446 public final int getSoTimeout() throws SocketException { |
423 if (self == this) { |
447 if (self == this) { |
424 return super.getSoTimeout(); |
448 return super.getSoTimeout(); |
425 } else { |
449 } else { |
426 return self.getSoTimeout(); |
450 return self.getSoTimeout(); |
427 } |
451 } |
428 } |
452 } |
429 |
453 |
|
454 @Override |
430 public final void setSendBufferSize(int size) throws SocketException { |
455 public final void setSendBufferSize(int size) throws SocketException { |
431 if (self == this) { |
456 if (self == this) { |
432 super.setSendBufferSize(size); |
457 super.setSendBufferSize(size); |
433 } else { |
458 } else { |
434 self.setSendBufferSize(size); |
459 self.setSendBufferSize(size); |
435 } |
460 } |
436 } |
461 } |
437 |
462 |
|
463 @Override |
438 public final int getSendBufferSize() throws SocketException { |
464 public final int getSendBufferSize() throws SocketException { |
439 if (self == this) { |
465 if (self == this) { |
440 return super.getSendBufferSize(); |
466 return super.getSendBufferSize(); |
441 } else { |
467 } else { |
442 return self.getSendBufferSize(); |
468 return self.getSendBufferSize(); |
443 } |
469 } |
444 } |
470 } |
445 |
471 |
|
472 @Override |
446 public final void setReceiveBufferSize(int size) throws SocketException { |
473 public final void setReceiveBufferSize(int size) throws SocketException { |
447 if (self == this) { |
474 if (self == this) { |
448 super.setReceiveBufferSize(size); |
475 super.setReceiveBufferSize(size); |
449 } else { |
476 } else { |
450 self.setReceiveBufferSize(size); |
477 self.setReceiveBufferSize(size); |
451 } |
478 } |
452 } |
479 } |
453 |
480 |
|
481 @Override |
454 public final int getReceiveBufferSize() throws SocketException { |
482 public final int getReceiveBufferSize() throws SocketException { |
455 if (self == this) { |
483 if (self == this) { |
456 return super.getReceiveBufferSize(); |
484 return super.getReceiveBufferSize(); |
457 } else { |
485 } else { |
458 return self.getReceiveBufferSize(); |
486 return self.getReceiveBufferSize(); |
486 /** |
516 /** |
487 * Sets traffic class or type-of-service octet in the IP header for |
517 * Sets traffic class or type-of-service octet in the IP header for |
488 * packets sent from this Socket. |
518 * packets sent from this Socket. |
489 * @see java.net.Socket#setTrafficClass |
519 * @see java.net.Socket#setTrafficClass |
490 */ |
520 */ |
|
521 @Override |
491 public final void setTrafficClass(int tc) throws SocketException { |
522 public final void setTrafficClass(int tc) throws SocketException { |
492 if (self == this) { |
523 if (self == this) { |
493 super.setTrafficClass(tc); |
524 super.setTrafficClass(tc); |
494 } else { |
525 } else { |
495 self.setTrafficClass(tc); |
526 self.setTrafficClass(tc); |
499 /** |
530 /** |
500 * Gets traffic class or type-of-service in the IP header for packets |
531 * Gets traffic class or type-of-service in the IP header for packets |
501 * sent from this Socket. |
532 * sent from this Socket. |
502 * @see java.net.Socket#getTrafficClass |
533 * @see java.net.Socket#getTrafficClass |
503 */ |
534 */ |
|
535 @Override |
504 public final int getTrafficClass() throws SocketException { |
536 public final int getTrafficClass() throws SocketException { |
505 if (self == this) { |
537 if (self == this) { |
506 return super.getTrafficClass(); |
538 return super.getTrafficClass(); |
507 } else { |
539 } else { |
508 return self.getTrafficClass(); |
540 return self.getTrafficClass(); |
536 /** |
570 /** |
537 * Sets performance preferences for this socket. |
571 * Sets performance preferences for this socket. |
538 * |
572 * |
539 * @see java.net.Socket#setPerformancePreferences(int, int, int) |
573 * @see java.net.Socket#setPerformancePreferences(int, int, int) |
540 */ |
574 */ |
|
575 @Override |
541 public void setPerformancePreferences(int connectionTime, |
576 public void setPerformancePreferences(int connectionTime, |
542 int latency, int bandwidth) { |
577 int latency, int bandwidth) { |
543 if (self == this) { |
578 if (self == this) { |
544 super.setPerformancePreferences( |
579 super.setPerformancePreferences( |
545 connectionTime, latency, bandwidth); |
580 connectionTime, latency, bandwidth); |