// Path: src/main/java/com/nmote/io/LoggingInputStream.java
// public class LoggingInputStream extends FilterInputStream {
// 
// 	private final static String PREFIX = "<< ";
// 
// 	public LoggingInputStream(InputStream in, Logger log) {
// 		this(in, log, 16);
// 	}
// 
// 	public LoggingInputStream(InputStream in, Logger log, int size) {
// 		this(in, log, size, true);
// 	}
// 
// 	public LoggingInputStream(InputStream in, Logger log, int size, boolean dumpPlainText) {
// 		super(in);
// 		support = new LoggingStreamSupport(log, PREFIX, size, dumpPlainText);
// 	}
// 
// 	@Override
// 	public synchronized void close() throws IOException {
// 		closeSupport();
// 		super.close();
// 	}
// 
// 	@Override
// 	public synchronized int read() throws IOException {
// 		int b = super.read();
// 		if (b != -1) {
// 			support.logByte(b);
// 		} else {
// 			closeSupport();
// 		}
// 
// 		return b;
// 	}
// 
// 	private void closeSupport() {
// 		if (support != null) {
// 			support.close();
// 			support = null;
// 		}
// 	}
// 
// 	private LoggingStreamSupport support;
// }
// 
// Path: src/main/java/com/nmote/io/LoggingOutputStream.java
// public class LoggingOutputStream extends FilterOutputStream {
// 
// 	private final static String PREFIX = ">> ";
// 
// 	public LoggingOutputStream(OutputStream in, Logger log) {
// 		this(in, log, 16);
// 	}
// 
// 	public LoggingOutputStream(OutputStream in, Logger log, int size) {
// 		this(in, log, size, true);
// 	}
// 
// 	public LoggingOutputStream(OutputStream in, Logger log, int size, boolean dumpPlainText) {
// 		super(in);
// 		support = new LoggingStreamSupport(log, PREFIX, size, dumpPlainText);
// 	}
// 
// 	@Override
// 	public synchronized void close() throws IOException {
// 		closeSupport();
// 		super.close();
// 	}
// 
// 	@Override
// 	public synchronized void flush() throws IOException {
// 		support.flush();
// 		super.flush();
// 	}
// 
// 	@Override
// 	public void write(int b) throws IOException {
// 		support.logByte(b);
// 		super.write(b);
// 	}
// 
// 	private void closeSupport() {
// 		if (support != null) {
// 			support.close();
// 			support = null;
// 		}
// 	}
// 
// 	private LoggingStreamSupport support;
// }


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.nmote.io.LoggingInputStream;
import com.nmote.io.LoggingOutputStream;

		output = new SMPPOutputStream(out);
	}

	@Override
	public void close() throws IOException {
		IOException ioe = null;
		try {
			try {
				if (input != null) {
					input.close();
				}
			} catch (IOException e) {
				log.debug("Closing input stream failed", e);
				ioe = e;
			}

			try {
				if (output != null) {
					output.close();
				}
			} catch (IOException e) {
				log.debug("Closing output stream failed", e);
				ioe = e;
			}
		} finally {
			input = null;
			output = null;
		}

		if (ioe != null) {

// Path: src/main/java/com/nmote/io/LoggingInputStream.java
// public class LoggingInputStream extends FilterInputStream {
// 
// 	private final static String PREFIX = "<< ";
// 
// 	public LoggingInputStream(InputStream in, Logger log) {
// 		this(in, log, 16);
// 	}
// 
// 	public LoggingInputStream(InputStream in, Logger log, int size) {
// 		this(in, log, size, true);
// 	}
// 
// 	public LoggingInputStream(InputStream in, Logger log, int size, boolean dumpPlainText) {
// 		super(in);
// 		support = new LoggingStreamSupport(log, PREFIX, size, dumpPlainText);
// 	}
// 
// 	@Override
// 	public synchronized void close() throws IOException {
// 		closeSupport();
// 		super.close();
// 	}
// 
// 	@Override
// 	public synchronized int read() throws IOException {
// 		int b = super.read();
// 		if (b != -1) {
// 			support.logByte(b);
// 		} else {
// 			closeSupport();
// 		}
// 
// 		return b;
// 	}
// 
// 	private void closeSupport() {
// 		if (support != null) {
// 			support.close();
// 			support = null;
// 		}
// 	}
// 
// 	private LoggingStreamSupport support;
// }
// 
// Path: src/main/java/com/nmote/io/LoggingOutputStream.java
// public class LoggingOutputStream extends FilterOutputStream {
// 
// 	private final static String PREFIX = ">> ";
// 
// 	public LoggingOutputStream(OutputStream in, Logger log) {
// 		this(in, log, 16);
// 	}
// 
// 	public LoggingOutputStream(OutputStream in, Logger log, int size) {
// 		this(in, log, size, true);
// 	}
// 
// 	public LoggingOutputStream(OutputStream in, Logger log, int size, boolean dumpPlainText) {
// 		super(in);
// 		support = new LoggingStreamSupport(log, PREFIX, size, dumpPlainText);
// 	}
// 
// 	@Override
// 	public synchronized void close() throws IOException {
// 		closeSupport();
// 		super.close();
// 	}
// 
// 	@Override
// 	public synchronized void flush() throws IOException {
// 		support.flush();
// 		super.flush();
// 	}
// 
// 	@Override
// 	public void write(int b) throws IOException {
// 		support.logByte(b);
// 		super.write(b);
// 	}
// 
// 	private void closeSupport() {
// 		if (support != null) {
// 			support.close();
// 			support = null;
// 		}
// 	}
// 
// 	private LoggingStreamSupport support;
// }


// Path: src/main/java/com/nmote/smpp/StreamLink.java
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.nmote.io.LoggingInputStream;
import com.nmote.io.LoggingOutputStream;

		output = new SMPPOutputStream(out);
	}

	@Override
	public void close() throws IOException {
		IOException ioe = null;
		try {
			try {
				if (input != null) {
					input.close();
				}
			} catch (IOException e) {
				log.debug("Closing input stream failed", e);
				ioe = e;
			}

			try {
				if (output != null) {
					output.close();
				}
			} catch (IOException e) {
				log.debug("Closing output stream failed", e);
				ioe = e;
			}
		} finally {
			input = null;
			output = null;
		}

		if (ioe != null) {

			throw new IOException("Closing SMPP streams failed: " + ioe);
