429 }
430 }
431
432 private static final Set<SocketOption<?>> socketOptions =
433 new HashSet<>();
434
435 private static final Set<SocketOption<?>> serverSocketOptions =
436 new HashSet<>();
437
438 static {
439 socketOptions.add(StandardSocketOptions.SO_KEEPALIVE);
440 socketOptions.add(StandardSocketOptions.SO_SNDBUF);
441 socketOptions.add(StandardSocketOptions.SO_RCVBUF);
442 socketOptions.add(StandardSocketOptions.SO_REUSEADDR);
443 socketOptions.add(StandardSocketOptions.SO_LINGER);
444 socketOptions.add(StandardSocketOptions.IP_TOS);
445 socketOptions.add(StandardSocketOptions.TCP_NODELAY);
446
447 serverSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
448 serverSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
449 };
450
451 /**
452 * Returns a set of SocketOptions supported by this impl
453 * and by this impl's socket (Socket or ServerSocket)
454 *
455 * @return a Set of SocketOptions
456 */
457 protected Set<SocketOption<?>> supportedOptions() {
458 if (getSocket() != null) {
459 return socketOptions;
460 } else {
461 return serverSocketOptions;
462 }
463 }
464 }
|
429 }
430 }
431
432 private static final Set<SocketOption<?>> socketOptions =
433 new HashSet<>();
434
435 private static final Set<SocketOption<?>> serverSocketOptions =
436 new HashSet<>();
437
438 static {
439 socketOptions.add(StandardSocketOptions.SO_KEEPALIVE);
440 socketOptions.add(StandardSocketOptions.SO_SNDBUF);
441 socketOptions.add(StandardSocketOptions.SO_RCVBUF);
442 socketOptions.add(StandardSocketOptions.SO_REUSEADDR);
443 socketOptions.add(StandardSocketOptions.SO_LINGER);
444 socketOptions.add(StandardSocketOptions.IP_TOS);
445 socketOptions.add(StandardSocketOptions.TCP_NODELAY);
446
447 serverSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
448 serverSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
449 serverSocketOptions.add(StandardSocketOptions.IP_TOS);
450 };
451
452 /**
453 * Returns a set of SocketOptions supported by this impl
454 * and by this impl's socket (Socket or ServerSocket)
455 *
456 * @return a Set of SocketOptions
457 */
458 protected Set<SocketOption<?>> supportedOptions() {
459 if (getSocket() != null) {
460 return socketOptions;
461 } else {
462 return serverSocketOptions;
463 }
464 }
465 }
|