1 /* 2 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 3 * The software in this package is published under the terms of the CPAL v1.0 4 * license, a copy of which has been included with this distribution in the 5 * LICENSE.txt file. 6 */ 7 package org.mule.transport.tcp.integration; 8 9 import java.io.IOException; 10 import java.io.InputStream; 11 12 public class EOFEchoStreamTestComponent 13 { 14 public Object invoke(final InputStream is) throws IOException 15 { 16 byte[] buf = new byte[is.available()]; 17 int n = 0; 18 int total = 0; 19 while (total < 16) 20 { 21 n = is.read(buf); 22 total += n; 23 } 24 is.close(); 25 26 return new String(buf); 27 } 28 } 29 30