### Question:
LogChannel extends BaseChannel { protected void connect (Socket socket) throws IOException { super.connect (socket); reader = new BufferedReader (new InputStreamReader (serverIn)); } LogChannel();  LogChannel(String host, int port, ISOPackager p);  LogChannel(ISOPackager p);  LogChannel(ISOPackager p, ServerSocket serverSocket); void disconnect(); @Override void setConfiguration(Configuration cfg);  }### Answer:
@Test public void testConnectThrowsSocketException() throws Throwable { LogChannel logChannel = new LogChannel(new ISO87APackagerBBitmap()); Socket socket = new Socket(); socket.close(); try { logChannel.connect(socket); fail("Expected SocketException to be thrown"); } catch (SocketException ex) { assertEquals(SocketException.class, ex.getClass(), "ex.getClass()"); assertEquals("org.jpos.iso.channel.LogChannel", logChannel.getOriginalRealm(), "logChannel.getOriginalRealm()"); assertEquals(3, logChannel.getCounters().length, "logChannel.getCounters().length"); assertNull(logChannel.getRealm(), "logChannel.getRealm()"); assertSame(socket, logChannel.getSocket(), "logChannel.getSocket()"); assertFalse(logChannel.isConnected(), "logChannel.isConnected()"); assertNull(logChannel.getLogger(), "logChannel.getLogger()"); assertNull(logChannel.reader, "logChannel.reader"); assertNull(socket.getChannel(), "socket.getChannel()"); } }