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 org.junit.Before;
12 import org.junit.Test;
13 import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
15 import static org.junit.Assert.assertArrayEquals;
16 import static org.junit.Assert.assertEquals;
18 public class MessageHeaderTest {
20 private NetconfMessageHeader header = null;
24 this.header = new NetconfMessageHeader();
28 public void testFromBytes() {
29 final byte[] raw = new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x35, (byte) 0x38, (byte) 0x0a };
30 this.header.fromBytes(raw);
31 assertEquals(58, this.header.getLength());
35 public void testToBytes() {
36 this.header.setLength(123);
37 assertArrayEquals(new byte[] { (byte) 0x0a, (byte) 0x23, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x0a },
38 this.header.toBytes());