### Question:
Selector implements Selectable { @Override public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType) throws IOException { SocketChannel channel = SocketChannel.open(); channel.configureBlocking(false); Socket socket = channel.socket(); socket.setKeepAlive(true); socket.setSendBufferSize(sendBufferSize); socket.setReceiveBufferSize(receiveBufferSize); socket.setTcpNoDelay(true); try { channel.connect(address); } catch (UnresolvedAddressException e) { channel.close(); throw new IOException("Can't resolve address: " + address, e); } catch (IOException e) { channel.close(); throw e; } String connectionId = generateConnectionId(channel); SelectionKey key = channel.register(this.nioSelector, SelectionKey.OP_CONNECT); Transmission transmission; try { transmission = createTransmission(connectionId, key, address.getHostName(), address.getPort(), portType, SSLFactory.Mode.CLIENT); } catch (IOException e) { logger.error("IOException on transmission creation {}", e); channel.socket().close(); channel.close(); throw e; } key.attach(transmission); this.keyMap.put(connectionId, key); numActiveConnections.set(this.keyMap.size()); return connectionId; } Selector(NetworkMetrics metrics, Time time, SSLFactory sslFactory, NetworkConfig networkConfig); @Override String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType); String register(SocketChannel channel, PortType portType); @Override void disconnect(String connectionId); @Override void wakeup(); @Override void close(); @Override boolean isOpen(); void send(NetworkSend networkSend); @Override void poll(long timeoutMs); @Override void poll(long timeoutMs, List<NetworkSend> sends); boolean isChannelReady(String connectionId); @Override List<NetworkSend> completedSends(); @Override List<NetworkReceive> completedReceives(); @Override List<String> disconnected(); @Override List<String> connected(); @Override void close(String connectionId);  }### Answer:
@Test(expected = IOException.class) public void testNoRouteToHost() throws Exception { selector.connect(new InetSocketAddress("asdf.asdf.dsc", server.port), BUFFER_SIZE, BUFFER_SIZE, PortType.PLAINTEXT); }