2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.impl;
11 import static org.junit.Assert.assertArrayEquals;
12 import static org.junit.Assert.assertEquals;
14 import org.junit.Test;
15 import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
18 public class MessageHeaderTest {
20 public void testFromBytes() {
21 final byte[] raw = new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x35, (byte) 0x38, (byte) 0x0a };
22 NetconfMessageHeader header = NetconfMessageHeader.fromBytes(raw);
23 assertEquals(58, header.getLength());
27 public void testToBytes() {
28 NetconfMessageHeader header = new NetconfMessageHeader(123);
29 assertArrayEquals(new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x0a },