1 19 20 package com.sslexplorer.agent.client; 21 22 import java.io.IOException ; 23 import java.io.InputStream ; 24 import java.io.OutputStream ; 25 import java.net.Socket ; 26 27 import com.maverick.multiplex.Channel; 28 import com.maverick.multiplex.ChannelOpenException; 29 import com.maverick.multiplex.channels.LocalForwardingChannel; 30 31 class LocalForwardingChannelSocket extends Socket { 32 33 private Channel channel; 34 private Agent agent; 35 36 public LocalForwardingChannelSocket(Agent agent, String host, int port) throws IOException , ChannelOpenException { 37 super(); 38 this.agent = agent; 39 channel = new LocalForwardingChannel(host, port); 40 agent.getConnection().openChannel(channel); 41 } 42 43 public LocalForwardingChannelSocket(String host, int port) throws IOException { 44 super(host, port); 45 } 46 47 public InputStream getInputStream() throws IOException { 48 return channel.getInputStream(); 49 } 50 51 public OutputStream getOutputStream() throws IOException { 52 return channel.getOutputStream(); 53 } 54 55 public synchronized void close() throws IOException { 56 DirectTCPSocketFactory.log.info("Channel socket closed."); 57 channel.close(); 58 } 59 } 60 | Popular Tags |