@Before public void init() throws IOException { port = getNextAvailable(); server = getServer(); server.start(port); client = getClient(); data = new byte[messageSize + 4]; data[0] = (byte) (messageSize >>> 24 & 255); data[1] = (byte) (messageSize >>> 16 & 255); data[2] = (byte) (messageSize >>> 8 & 255); data[3] = (byte) (messageSize & 255); }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
/** * {@inheritDoc} */ @Override public void setTcpNoDelay(boolean on) { try { getSocket().setTcpNoDelay(on); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * Wait on all the {@link IoFuture}s we get. * * @param futures The {@link IoFuture}s we are waiting on * @param timeout The maximum time we wait for the {@link IoFuture}s to complete * @param unit The Time unit to use for the timeout * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted */ public static boolean awaitUninterruptibly(Iterable<? extends IoFuture> futures, long timeout, TimeUnit unit) { return awaitUninterruptibly(futures, unit.toMillis(timeout)); }
client.start(port, counter, data); long globalSent = 0; long warmedUpSent = 0;
/** * {@inheritDoc} */ @Override public void setReceiveBufferSize(int size) { try { getSocket().setReceiveBufferSize(size); } catch (SocketException e) { throw new RuntimeIoException(e); } } }
/** * Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted * * @param futures The {@link IoFuture}s we are waiting on * @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete * @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if * at least one {@link IoFuture} has been interrupted * @throws InterruptedException If one of the {@link IoFuture} is interrupted */ public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
/** * {@inheritDoc} */ @Override public void setReuseAddress(boolean on) { try { getSocket().setReuseAddress(on); } catch (SocketException e) { throw new RuntimeIoException(e); } }
public static boolean await(Iterable<? extends IoFuture> futures, long timeoutMillis) throws InterruptedException { return await0(futures, timeoutMillis, true); }
/** * {@inheritDoc} */ @Override public void setReuseAddress(boolean on) { try { getSocket().setReuseAddress(on); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public int getSendBufferSize() { try { return getSocket().getSendBufferSize(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public boolean isReuseAddress() { try { return getSocket().getReuseAddress(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public int getSoLinger() { try { return getSocket().getSoLinger(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public boolean isOobInline() { try { return getSocket().getOOBInline(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public int getTrafficClass() { try { return getSocket().getTrafficClass(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public boolean isKeepAlive() { try { return getSocket().getKeepAlive(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public int getSoLinger() { try { return getSocket().getSoLinger(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public boolean isReuseAddress() { try { return getSocket().getReuseAddress(); } catch (SocketException e) { throw new RuntimeIoException(e); } }
/** * {@inheritDoc} */ @Override public int getTrafficClass() { try { return getSocket().getTrafficClass(); } catch (SocketException e) { throw new RuntimeIoException(e); } }