本文整理汇总了Java中com.digitalpetri.opcua.stack.core.StatusCodes.Bad_TcpMessageTypeInvalid方法的典型用法代码示例。如果您正苦于以下问题:Java StatusCodes.Bad_TcpMessageTypeInvalid方法的具体用法?Java StatusCodes.Bad_TcpMessageTypeInvalid怎么用?Java StatusCodes.Bad_TcpMessageTypeInvalid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.digitalpetri.opcua.stack.core.StatusCodes
的用法示例。
在下文中一共展示了StatusCodes.Bad_TcpMessageTypeInvalid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeMessage
import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
private void decodeMessage(ChannelHandlerContext ctx, ByteBuf buffer) throws UaException {
int messageLength = getMessageLength(buffer);
MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));
switch (messageType) {
case OpenSecureChannel:
onOpenSecureChannel(ctx, buffer.readSlice(messageLength));
break;
case SecureMessage:
onSecureMessage(ctx, buffer.readSlice(messageLength));
break;
case Error:
onError(ctx, buffer.readSlice(messageLength));
break;
default:
throw new UaException(
StatusCodes.Bad_TcpMessageTypeInvalid,
"unexpected MessageType: " + messageType);
}
}
示例2: decode
import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
while (buffer.readableBytes() >= HEADER_LENGTH &&
buffer.readableBytes() >= getMessageLength(buffer)) {
int messageLength = getMessageLength(buffer);
MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));
switch (messageType) {
case Hello:
onHello(ctx, buffer.readSlice(messageLength));
break;
default:
throw new UaException(StatusCodes.Bad_TcpMessageTypeInvalid,
"unexpected MessageType: " + messageType);
}
}
}
示例3: decode
import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
while (buffer.readableBytes() >= HEADER_LENGTH &&
buffer.readableBytes() >= getMessageLength(buffer)) {
int messageLength = getMessageLength(buffer);
MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));
switch (messageType) {
case OpenSecureChannel:
onOpenSecureChannel(ctx, buffer.readSlice(messageLength));
break;
case CloseSecureChannel:
logger.debug("Received CloseSecureChannelRequest");
if (secureChannel != null) {
server.closeSecureChannel(secureChannel);
}
buffer.skipBytes(messageLength);
break;
default:
throw new UaException(StatusCodes.Bad_TcpMessageTypeInvalid,
"unexpected MessageType: " + messageType);
}
}
}