@Override public boolean getTcpNoDelay() throws SocketException { return sock.getTcpNoDelay(); }
@Override public boolean isTcpNoDelay() { try { return javaSocket.getTcpNoDelay(); } catch (SocketException e) { throw new ChannelException(e); } }
@Override public boolean isTcpNoDelay() { try { return javaSocket.getTcpNoDelay(); } catch (SocketException e) { throw new ChannelException(e); } }
/** * See {@link Socket#getTcpNoDelay()}. Calling this method does not trigger mode detection. */ @Override public boolean getTcpNoDelay() throws SocketException { return getSocketAllowUnknownMode().getTcpNoDelay(); }
@Override public boolean isTcpNoDelay() { try { return javaSocket.getTcpNoDelay(); } catch (SocketException e) { throw new ChannelException(e); } }
public boolean isTcpNoDelay() { try { return socket.getTcpNoDelay(); } catch (SocketException e) { throw new ChannelException(e); } }
public <T> T getOption(final Option<T> option) throws IOException { if (option == Options.CLOSE_ABORT) { return option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getSoLinger() == 0)); } else if (option == Options.IP_TRAFFIC_CLASS) { return option.cast(Integer.valueOf(conduit.getSocketChannel().socket().getTrafficClass())); } else if (option == Options.KEEP_ALIVE) { return option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getKeepAlive())); } else if (option == Options.READ_TIMEOUT) { return option.cast(Integer.valueOf(conduit.getReadTimeout())); } else if (option == Options.RECEIVE_BUFFER) { return option.cast(Integer.valueOf(conduit.getSocketChannel().socket().getReceiveBufferSize())); } else if (option == Options.SEND_BUFFER) { return option.cast(Integer.valueOf(conduit.getSocketChannel().socket().getSendBufferSize())); } else if (option == Options.TCP_NODELAY) { return option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getTcpNoDelay())); } else if (option == Options.TCP_OOB_INLINE) { return option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getOOBInline())); } else if (option == Options.WRITE_TIMEOUT) { return option.cast(Integer.valueOf(conduit.getWriteTimeout())); } else { return null; } }
conduit.getSocketChannel().socket().setSendBufferSize(Options.SEND_BUFFER.cast(value).intValue()); } else if (option == Options.TCP_NODELAY) { result = option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getTcpNoDelay())); conduit.getSocketChannel().socket().setTcpNoDelay(Options.TCP_NODELAY.cast(value, Boolean.FALSE).booleanValue()); } else if (option == Options.TCP_OOB_INLINE) {
@Nullable @Override public Object call() throws Exception { Socket sock = null; try { sock = new Socket(addr, 60000); X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ", NODELAY=" + sock.getTcpNoDelay() + ']'); sock.setTcpNoDelay(true); X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ", NODELAY=" + sock.getTcpNoDelay() + ']'); Thread.sleep(10000); return null; } finally { U.closeQuiet(sock); } } },
@Override public void run() { try { byte[] buf = new byte[1024]; int bytesRead = unifiedSocket.getInputStream().read(buf, 0, 1024); // Make sure the settings applied above before the socket was potentially upgraded to // TLS still apply. Assert.assertEquals(tcpNoDelay, unifiedSocket.getTcpNoDelay()); Assert.assertEquals(TIMEOUT, unifiedSocket.getSoTimeout()); Assert.assertEquals(keepAlive, unifiedSocket.getKeepAlive()); if (bytesRead > 0) { byte[] dataFromClient = new byte[bytesRead]; System.arraycopy(buf, 0, dataFromClient, 0, bytesRead); synchronized (dataFromClients) { dataFromClients.add(dataFromClient); } } unifiedSocket.getOutputStream().write(dataToClient); unifiedSocket.getOutputStream().flush(); } catch (IOException e) { throw new RuntimeException(e); } finally { forceClose(unifiedSocket); } } });
@Nullable @Override public Object call() throws Exception { ServerSocket srvSock = null; Socket sock = null; try { srvSock = new ServerSocket(60000, 0, addr); sock = srvSock.accept(); X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ", NODELAY=" + sock.getTcpNoDelay() + ']'); sock.setSoTimeout(2000); sock.setTcpNoDelay(true); X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ", NODELAY=" + sock.getTcpNoDelay() + ']'); sock.getInputStream().read(); } catch (IOException e) { X.println("Caught expected exception: " + e); e.printStackTrace(); } finally { U.closeQuiet(srvSock); U.closeQuiet(sock); } return null; } },
return delegate.getTcpNoDelay();
return delegate.getTcpNoDelay();
return delegate.getTcpNoDelay();
/** * Returns true if Nagle's algorithm is enabled on the currently opened * socket. * <p> * @return True if Nagle's algorithm is enabled on the currently opened * socket, false otherwise. * @throws SocketException If the operation fails. * @throws NullPointerException if the socket is not currently open */ public boolean getTcpNoDelay() throws SocketException { return _socket_.getTcpNoDelay(); }
@Override public boolean getTcpNoDelay() throws SocketException { return socket.getTcpNoDelay(); }
@Override public boolean getTcpNoDelay() throws SocketException { return socket.getTcpNoDelay(); }
/** * {@inheritDoc} */ @Override public Boolean isTcpNoDelay() { try { return socket.getTcpNoDelay(); } catch (SocketException e) { throw new ConfigurationException(e); } }
Assert.assertEquals(false, socket.getTcpNoDelay());
Assert.assertEquals(false, socket.getOOBInline()); Assert.assertEquals(false, socket.getReuseAddress()); Assert.assertEquals(false, socket.getTcpNoDelay());