@Override
    public void bind(String addr) throws IOException {
        if (this.myState != state.INIT)
            throw new IllegalStateException("invoke bind non-init socket");

        if (addr.startsWith("tcp://") && this.domain == JMsg.TCP) {
            String sub = addr.substring("tcp://".length());
            String[] part = sub.split(":");

            if (part.length != 2)
                throw new IllegalArgumentException("Illegal addr: " + addr);

            int port = Integer.parseInt(part[1]);
            if (port == 0)
                throw new IllegalArgumentException("Illegal port: " + part[1]);

            this.channel.socket().bind(new InetSocketAddress(part[0], port));

            try {
                this.channel.register(JMsg.getSelector(), OP_ACCEPT, this.atta);
            } catch (ClosedChannelException e) {
                throw new IllegalStateException("channel is closed");
            }
            this.myState = state.CAN_READ;
        } else
            throw new IllegalArgumentException("unknow addr: " + addr);
    }