@Override public int receive(byte[] buf, int off, int len, int waitMillis) throws IOException { int length = transport.receive(buf, off, len, waitMillis); if (length >= 0) { dumpDatagram("Received", buf, off, length); } return length; }
@Override public int receive(byte[] buf, int off, int len, int waitMillis) throws IOException { int length = transport.receive(buf, off, len, waitMillis); if (length >= 0) { dumpDatagram("Received", buf, off, length); } return length; }
private int receiveRecord(byte[] buf, int off, int len, int waitMillis) throws IOException { if (recordQueue.available() > 0) { int length = 0; if (recordQueue.available() >= RECORD_HEADER_LENGTH) { byte[] lengthBytes = new byte[2]; recordQueue.read(lengthBytes, 0, 2, 11); length = TlsUtils.readUint16(lengthBytes, 0); } int received = Math.min(recordQueue.available(), RECORD_HEADER_LENGTH + length); recordQueue.removeData(buf, off, received, 0); return received; } int received = transport.receive(buf, off, len, waitMillis); if (received >= RECORD_HEADER_LENGTH) { int fragmentLength = TlsUtils.readUint16(buf, off + 11); int recordLength = RECORD_HEADER_LENGTH + fragmentLength; if (received > recordLength) { recordQueue.addData(buf, off + recordLength, received - recordLength); received = recordLength; } } return received; }
private int receiveRecord(byte[] buf, int off, int len, int waitMillis) throws IOException { if (recordQueue.available() > 0) { int length = 0; if (recordQueue.available() >= RECORD_HEADER_LENGTH) { byte[] lengthBytes = new byte[2]; recordQueue.read(lengthBytes, 0, 2, 11); length = TlsUtils.readUint16(lengthBytes, 0); } int received = Math.min(recordQueue.available(), RECORD_HEADER_LENGTH + length); recordQueue.removeData(buf, off, received, 0); return received; } int received = transport.receive(buf, off, len, waitMillis); if (received >= RECORD_HEADER_LENGTH) { int fragmentLength = TlsUtils.readUint16(buf, off + 11); int recordLength = RECORD_HEADER_LENGTH + fragmentLength; if (received > recordLength) { recordQueue.addData(buf, off + recordLength, received - recordLength); received = recordLength; } } return received; }