@Test public void instrumentDirectory() throws Exception { ASCII.putLongRight(instrumentDirectory.numberOfCurrencyPairs, 3); ASCII.putLeft(instrumentDirectory.currencyPair[0], "FOO/BAR"); ASCII.putLeft(instrumentDirectory.currencyPair[1], "BAR/BAZ"); ASCII.putLeft(instrumentDirectory.currencyPair[2], "BAZ/FOO"); server.instrumentDirectory(instrumentDirectory); while (clientEvents.collect().size() != 1) client.receive(); assertEquals(asList(new InstrumentDirectory(asList("FOO/BAR", "BAR/BAZ", "BAZ/FOO"))), clientEvents.collect()); }
public int receive() throws IOException { int bytes = channel.read(rxBuffer); if (bytes <= 0) return bytes; rxBuffer.flip(); while (parse()); rxBuffer.compact(); if (rxBuffer.position() == rxBuffer.capacity()) throw new ITCHException("Packet length exceeds buffer capacity"); receivedData(); return bytes; }
ITCHSession implements Closeable { public int receive() throws IOException { int bytes = channel.read(rxBuffer); if (bytes <= 0) return bytes; rxBuffer.flip(); while (parse()); rxBuffer.compact(); if (rxBuffer.position() == rxBuffer.capacity()) throw new ITCHException("Packet length exceeds buffer capacity"); receivedData(); return bytes; } }
ITCHSession implements Closeable { public int receive() throws IOException { int bytes = channel.read(rxBuffer); if (bytes <= 0) return bytes; rxBuffer.flip(); while (parse()); rxBuffer.compact(); if (rxBuffer.position() == rxBuffer.capacity()) throw new ITCHException("Packet length exceeds buffer capacity"); receivedData(); return bytes; } protected  ITCHSession(Clock clock, SocketChannel channel, int rxBufferCapacity,
            byte heartbeatMessageType); }
ITCHSession implements Closeable { public int receive() throws IOException { int bytes = channel.read(rxBuffer); if (bytes <= 0) return bytes; rxBuffer.flip(); while (parse()); rxBuffer.compact(); if (rxBuffer.position() == rxBuffer.capacity()) throw new ITCHException("Packet length exceeds buffer capacity"); receivedData(); return bytes; } protected  ITCHSession(Clock clock, SocketChannel channel, int rxBufferCapacity,
            byte heartbeatMessageType); SocketChannel getChannel(); int receive(); void keepAlive(); @Override void close(); }
ITCHSession implements Closeable { public int receive() throws IOException { int bytes = channel.read(rxBuffer); if (bytes <= 0) return bytes; rxBuffer.flip(); while (parse()); rxBuffer.compact(); if (rxBuffer.position() == rxBuffer.capacity()) throw new ITCHException("Packet length exceeds buffer capacity"); receivedData(); return bytes; } protected  ITCHSession(Clock clock, SocketChannel channel, int rxBufferCapacity,
            byte heartbeatMessageType); SocketChannel getChannel(); int receive(); void keepAlive(); @Override void close();  }