case Protocol.O_END: break OUT; case Protocol.O_SERVICE_NAME: { serviceType = ProtocolUtils.readString(buffer); break; requestedOutboundWindow = Math.min(requestedOutboundWindow, ProtocolUtils.readInt(buffer)); break; requestedOutboundMessages = Math.min(requestedOutboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedInboundWindow = Math.min(requestedInboundWindow, ProtocolUtils.readInt(buffer)); break; requestedInboundMessages = Math.min(requestedInboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedOutboundMessageSize = Math.min(requestedOutboundMessageSize, ProtocolUtils.readLong(buffer)); break; requestedInboundMessageSize = Math.min(requestedInboundMessageSize, ProtocolUtils.readLong(buffer)); break; replyBuffer.put(Protocol.CHANNEL_OPEN_ACK); replyBuffer.putInt(channelId); ProtocolUtils.writeInt(replyBuffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindow); ProtocolUtils.writeShort(replyBuffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessages); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(replyBuffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize);
useDefaultChannels = false; channelsOut = ProtocolUtils.readIntData(data, len); client.tracef("Client received capability: remote channels in is \"%d\"", channelsOut); break; useDefaultChannels = false; channelsIn = ProtocolUtils.readIntData(data, len); client.tracef("Client received capability: remote channels out is \"%d\"", channelsIn); break; sendBuffer.put(mechanismName.getBytes(StandardCharsets.UTF_8)); } else { ProtocolUtils.writeString(sendBuffer, mechanismName); if (response != null) { sendBuffer.put(response);
ByteBuffer sendBuffer = pooled.getResource(); sendBuffer.put(Protocol.CAPABILITIES); ProtocolUtils.writeByte(sendBuffer, Protocol.CAP_VERSION, version); final String localEndpointName = connectionProviderContext.getEndpoint().getName(); if (localEndpointName != null) { ProtocolUtils.writeString(sendBuffer, Protocol.CAP_ENDPOINT_NAME, localEndpointName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_STARTTLS); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_SASL_MECH, mechName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_MESSAGE_CLOSE); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_VERSION_STRING, Version.getVersionString()); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_IN, optionMap.get(RemotingOptions.MAX_INBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_INBOUND_CHANNELS)); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_OUT, optionMap.get(RemotingOptions.MAX_OUTBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_OUTBOUND_CHANNELS)); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_AUTHENTICATION); sendBuffer.flip(); connection.send(pooled);
buffer.put(Protocol.CHANNEL_OPEN_REQUEST); buffer.putInt(id); ProtocolUtils.writeBytes(buffer, Protocol.O_SERVICE_NAME, serviceTypeBytes); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessageCount); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_OUTBOUND_MSG_WINDOW_SIZE, outboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_OUTBOUND_MSG_COUNT, outboundMessageCount); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(buffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize); ProtocolUtils.writeLong(buffer, Protocol.O_MAX_OUTBOUND_MSG_SIZE, outboundMessageSize);
static int readInt(final ByteBuffer buffer) { int length = buffer.get() & 0xff; return readIntData(buffer, length); }
mechName = Buffers.getModifiedUtf8(receiveBuffer); } else { mechName = ProtocolUtils.readString(receiveBuffer);
buffer.put(Protocol.CHANNEL_OPEN_REQUEST); buffer.putInt(id); ProtocolUtils.writeBytes(buffer, Protocol.O_SERVICE_NAME, serviceTypeBytes); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessageCount); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_OUTBOUND_MSG_WINDOW_SIZE, outboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_OUTBOUND_MSG_COUNT, outboundMessageCount); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(buffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize); ProtocolUtils.writeLong(buffer, Protocol.O_MAX_OUTBOUND_MSG_SIZE, outboundMessageSize);
useDefaultChannels = false; channelsOut = ProtocolUtils.readIntData(data, len); server.tracef("Server received capability: remote channels in is \"%d\"", channelsOut); break; useDefaultChannels = false; channelsIn = ProtocolUtils.readIntData(data, len); server.tracef("Server received capability: remote channels out is \"%d\"", channelsIn); break;
mechName = Buffers.getModifiedUtf8(receiveBuffer); } else { mechName = ProtocolUtils.readString(receiveBuffer);
case Protocol.O_END: break OUT; case Protocol.O_SERVICE_NAME: { serviceType = ProtocolUtils.readString(buffer); break; requestedOutboundWindow = Math.min(requestedOutboundWindow, ProtocolUtils.readInt(buffer)); break; requestedOutboundMessages = Math.min(requestedOutboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedInboundWindow = Math.min(requestedInboundWindow, ProtocolUtils.readInt(buffer)); break; requestedInboundMessages = Math.min(requestedInboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedOutboundMessageSize = Math.min(requestedOutboundMessageSize, ProtocolUtils.readLong(buffer)); break; requestedInboundMessageSize = Math.min(requestedInboundMessageSize, ProtocolUtils.readLong(buffer)); break; replyBuffer.put(Protocol.CHANNEL_OPEN_ACK); replyBuffer.putInt(channelId); ProtocolUtils.writeInt(replyBuffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindow); ProtocolUtils.writeShort(replyBuffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessages); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(replyBuffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize);
final ByteBuffer sendBuffer = pooledSendBuffer.getResource(); sendBuffer.put(Protocol.CAPABILITIES); ProtocolUtils.writeByte(sendBuffer, Protocol.CAP_VERSION, Protocol.VERSION); final String localEndpointName = connectionProviderContext.getEndpoint().getName(); if (localEndpointName != null) { ProtocolUtils.writeString(sendBuffer, Protocol.CAP_ENDPOINT_NAME, localEndpointName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_MESSAGE_CLOSE); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_VERSION_STRING, Version.getVersionString()); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_IN, optionMap.get(RemotingOptions.MAX_INBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_INBOUND_CHANNELS)); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_OUT, optionMap.get(RemotingOptions.MAX_OUTBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_OUTBOUND_CHANNELS)); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_AUTHENTICATION); final Collection<String> serverMechs = this.serverMechs; if (serverMechs != null) { for (String name : serverMechs) { ProtocolUtils.writeString(sendBuffer, Protocol.CAP_SASL_MECH, name);
buffer.put(Protocol.CHANNEL_OPEN_REQUEST); buffer.putInt(id); ProtocolUtils.writeBytes(buffer, Protocol.O_SERVICE_NAME, serviceTypeBytes); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessageCount); ProtocolUtils.writeInt(buffer, Protocol.O_MAX_OUTBOUND_MSG_WINDOW_SIZE, outboundWindowSize); ProtocolUtils.writeShort(buffer, Protocol.O_MAX_OUTBOUND_MSG_COUNT, outboundMessageCount); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(buffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize); ProtocolUtils.writeLong(buffer, Protocol.O_MAX_OUTBOUND_MSG_SIZE, outboundMessageSize);
useDefaultChannels = false; channelsOut = ProtocolUtils.readIntData(data, len); client.tracef("Client received capability: remote channels in is \"%d\"", channelsOut); break; useDefaultChannels = false; channelsIn = ProtocolUtils.readIntData(data, len); client.tracef("Client received capability: remote channels out is \"%d\"", channelsIn); break; sendBuffer.put(mechanismName.getBytes(StandardCharsets.UTF_8)); } else { ProtocolUtils.writeString(sendBuffer, mechanismName); if (response != null) { sendBuffer.put(response);
static int readInt(final ByteBuffer buffer) { int length = buffer.get() & 0xff; return readIntData(buffer, length); }
mechName = Buffers.getModifiedUtf8(receiveBuffer); } else { mechName = ProtocolUtils.readString(receiveBuffer);
case Protocol.O_END: break OUT; case Protocol.O_SERVICE_NAME: { serviceType = ProtocolUtils.readString(buffer); break; requestedOutboundWindow = Math.min(requestedOutboundWindow, ProtocolUtils.readInt(buffer)); break; requestedOutboundMessages = Math.min(requestedOutboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedInboundWindow = Math.min(requestedInboundWindow, ProtocolUtils.readInt(buffer)); break; requestedInboundMessages = Math.min(requestedInboundMessages, ProtocolUtils.readUnsignedShort(buffer)); break; requestedOutboundMessageSize = Math.min(requestedOutboundMessageSize, ProtocolUtils.readLong(buffer)); break; requestedInboundMessageSize = Math.min(requestedInboundMessageSize, ProtocolUtils.readLong(buffer)); break; replyBuffer.put(Protocol.CHANNEL_OPEN_ACK); replyBuffer.putInt(channelId); ProtocolUtils.writeInt(replyBuffer, Protocol.O_MAX_INBOUND_MSG_WINDOW_SIZE, inboundWindow); ProtocolUtils.writeShort(replyBuffer, Protocol.O_MAX_INBOUND_MSG_COUNT, inboundMessages); if (inboundMessageSize != Long.MAX_VALUE) { ProtocolUtils.writeLong(replyBuffer, Protocol.O_MAX_INBOUND_MSG_SIZE, inboundMessageSize);
ByteBuffer sendBuffer = pooled.getResource(); sendBuffer.put(Protocol.CAPABILITIES); ProtocolUtils.writeByte(sendBuffer, Protocol.CAP_VERSION, version); final String localEndpointName = connectionProviderContext.getEndpoint().getName(); if (localEndpointName != null) { ProtocolUtils.writeString(sendBuffer, Protocol.CAP_ENDPOINT_NAME, localEndpointName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_STARTTLS); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_SASL_MECH, mechName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_MESSAGE_CLOSE); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_VERSION_STRING, Version.getVersionString()); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_IN, optionMap.get(RemotingOptions.MAX_INBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_INBOUND_CHANNELS)); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_OUT, optionMap.get(RemotingOptions.MAX_OUTBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_OUTBOUND_CHANNELS)); sendBuffer.flip(); connection.send(pooled);
static int readInt(final ByteBuffer buffer) { int length = buffer.get() & 0xff; return readIntData(buffer, length); }
ByteBuffer sendBuffer = pooled.getResource(); sendBuffer.put(Protocol.CAPABILITIES); ProtocolUtils.writeByte(sendBuffer, Protocol.CAP_VERSION, version); final String localEndpointName = connectionProviderContext.getEndpoint().getName(); if (localEndpointName != null) { ProtocolUtils.writeString(sendBuffer, Protocol.CAP_ENDPOINT_NAME, localEndpointName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_STARTTLS); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_SASL_MECH, mechName); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_MESSAGE_CLOSE); ProtocolUtils.writeString(sendBuffer, Protocol.CAP_VERSION_STRING, Version.getVersionString()); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_IN, optionMap.get(RemotingOptions.MAX_INBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_INBOUND_CHANNELS)); ProtocolUtils.writeInt(sendBuffer, Protocol.CAP_CHANNELS_OUT, optionMap.get(RemotingOptions.MAX_OUTBOUND_CHANNELS, RemotingOptions.DEFAULT_MAX_OUTBOUND_CHANNELS)); ProtocolUtils.writeEmpty(sendBuffer, Protocol.CAP_AUTHENTICATION); sendBuffer.flip(); connection.send(pooled);
useDefaultChannels = false; channelsOut = ProtocolUtils.readIntData(data, len); server.tracef("Server received capability: remote channels in is \"%d\"", channelsOut); break; useDefaultChannels = false; channelsIn = ProtocolUtils.readIntData(data, len); server.tracef("Server received capability: remote channels out is \"%d\"", channelsIn); break;