1 /* Licensed to the Apache Software Foundation (ASF) under one or more 2 * contributor license agreements. See the NOTICE file distributed with 3 * this work for additional information regarding copyright ownership. 4 * The ASF licenses this file to You under the Apache License, Version 2.0 5 * (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.harmony.tests.java.nio.channels; 18 19 import java.io.IOException; 20 import java.net.NetPermission; 21 import java.nio.channels.Pipe; 22 import java.nio.channels.Pipe.SinkChannel; 23 import java.nio.channels.Pipe.SourceChannel; 24 import java.security.Permission; 25 26 import junit.framework.TestCase; 27 28 /* 29 * Tests for Pipe and its default implementation 30 */ 31 public class PipeTest extends TestCase { 32 33 /** 34 * @tests java.nio.channels.Pipe#open() 35 */ 36 public void test_open() throws IOException{ 37 Pipe pipe = Pipe.open(); 38 assertNotNull(pipe); 39 } 40 41 /** 42 * @tests java.nio.channels.Pipe#sink() 43 */ 44 public void test_sink() throws IOException { 45 Pipe pipe = Pipe.open(); 46 SinkChannel sink = pipe.sink(); 47 assertTrue(sink.isBlocking()); 48 } 49 50 /** 51 * @tests java.nio.channels.Pipe#source() 52 */ 53 public void test_source() throws IOException { 54 Pipe pipe = Pipe.open(); 55 SourceChannel source = pipe.source(); 56 assertTrue(source.isBlocking()); 57 } 58 59 } 60