Java 8 AlreadyConnectedException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AlreadyConnectedException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.AlreadyConnectedException#AlreadyConnectedException()} 
     */ 
    public void test_Constructor() { 
        AlreadyConnectedException e = new AlreadyConnectedException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new AlreadyConnectedException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.AlreadyConnectedException#AlreadyConnectedException()} 
     */ 
    public void test_Constructor() { 
        AlreadyConnectedException e = new AlreadyConnectedException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    synchronized private void checkUnconnected() throws IOException { 
        if (!isOpen()) {
            throw new ClosedChannelException();
        } 
        if (status == SOCKET_STATUS_CONNECTED) {
            throw new AlreadyConnectedException();
        } 
        if (status == SOCKET_STATUS_PENDING) {
            throw new ConnectionPendingException();
        } 
    } 
 
    /* 
     * Shared by this class and DatagramChannelImpl, to do the address transfer 
     * and check. 
     */ 
    static InetSocketAddress validateAddress(SocketAddress socketAddress) {
        if (null == socketAddress) {
            throw new IllegalArgumentException();
        } 
4
CodeRank
This code example shows how to use the following methods:
        public void connect(SocketAddress remoteAddr, int timeout) throws IOException {
            if (!channel.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            if (isConnected()) { 
                throw new AlreadyConnectedException();
            } 
            super.connect(remoteAddr, timeout);
            channel.initLocalAddressAndPort();
            if (super.isConnected()) { 
                channel.setConnected();
                channel.isBound = super.isBound();
            } 
        } 
 
        @Override 
        public void bind(SocketAddress localAddr) throws IOException {
            if (channel.isConnected()) {
                throw new AlreadyConnectedException();
            } 
4
CodeRank
This code example shows how to use the following methods:
         * @see java.net.DatagramSocket#bind(java.net.SocketAddress) 
         */ 
        @Override 
        public void bind(SocketAddress localAddr) throws SocketException {
            if (channelImpl.isConnected()) {
                throw new AlreadyConnectedException();
            } 
            super.bind(localAddr);
            channelImpl.isBound = true;
        } 
 
        /** 
         * @see java.net.DatagramSocket#receive(java.net.DatagramPacket) 
         */ 
        @Override 
        public void receive(DatagramPacket packet) throws IOException {
            if (!channelImpl.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            super.receive(packet);
3
CodeRank
This code example shows how to use the following methods:
    synchronized private void checkUnconnected() throws IOException { 
        if (!isOpen()) {
            throw new ClosedChannelException();
        } 
        if (status == SOCKET_STATUS_CONNECTED) {
            throw new AlreadyConnectedException();
        } 
        if (status == SOCKET_STATUS_PENDING) {
            throw new ConnectionPendingException();
        } 
    } 
 
    /* 
     * Shared by this class and DatagramChannelImpl, to do the address transfer 
     * and check. 
     */ 
    static InetSocketAddress validateAddress(SocketAddress socketAddress) {
        if (null == socketAddress) {
            throw new IllegalArgumentException();
        } 
2
CodeRank
See Code Examples for Java 8 AlreadyConnectedException Methods: